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 --fqdn";
$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);
}