DataSift\Storyplayer\HostLib\SupportedHost::runCommandViaHostManager PHP Method

runCommandViaHostManager() public method

public runCommandViaHostManager ( HostDetails $hostDetails, string $command ) : CommandResult
$hostDetails HostDetails
$command string
return DataSift\Storyplayer\CommandLib\CommandResult
    public function runCommandViaHostManager($hostDetails, $command);

Usage Example

Example #1
0
 public function determineHostname($hostDetails, SupportedHost $host)
 {
     // what are we doing?
     $log = usingLog()->startAction("query " . basename(__CLASS__) . " for hostname");
     // how do we do this?
     $command = "hostname";
     $result = $host->runCommandViaHostManager($hostDetails, $command);
     if ($result->didCommandSucceed()) {
         $lines = explode("\n", $result->output);
         $hostname = trim($lines[0]);
         $hostname = $this->runHostnameSafeguards($hostDetails, $hostname);
         $log->endAction("hostname is '{$hostname}'");
         return $hostname;
     }
     // if we get here, we do not know what the hostname is
     $msg = "could not determine hostname";
     $log->endAction($msg);
     throw new E5xx_ActionFailed(__METHOD__, $msg);
 }
All Usage Examples Of DataSift\Storyplayer\HostLib\SupportedHost::runCommandViaHostManager