public function isRunning($vmDetails)
{
// what are we doing?
$log = usingLog()->startAction("determine status of Vagrant VM '{$vmDetails->hostId}'");
// if the box is running, it should have a status of 'running'
$command = "vagrant status";
$result = $this->runCommandAgainstHostManager($vmDetails, $command);
// reduce the output down to the exact host we are looking for
$lines = explode("\n", $result->output);
$lines = FilterForMatchingString::against($lines, $vmDetails->hostId);
$lines = FilterColumns::from($lines, "1", ' ');
// what is the status?
$state = trim($lines[0]);
if ($state != 'running') {
$log->endAction("VM is not running; state is '{$state}'");
return false;
}
// all done
$log->endAction("VM is running");
return true;
}