| @@ 174-189 (lines=16) @@ | ||
| 171 | * @param PhysicalHostDetails $vmDetails |
|
| 172 | * @return string |
|
| 173 | */ |
|
| 174 | public function determineIpAddress($vmDetails) |
|
| 175 | { |
|
| 176 | // what are we doing? |
|
| 177 | $log = usingLog()->startAction("determine IP address of physical host '{$vmDetails->hostId}'"); |
|
| 178 | ||
| 179 | // create an adapter to talk to the host operating system |
|
| 180 | $host = OsLib::getHostAdapter($this->st, $vmDetails->osName); |
|
| 181 | ||
| 182 | // get the IP address |
|
| 183 | $ipAddress = $host->determineIpAddress($vmDetails, $this); |
|
| 184 | $vmDetails->ipAddress = $ipAddress; |
|
| 185 | ||
| 186 | // all done |
|
| 187 | $log->endAction("IP address is '{$ipAddress}'"); |
|
| 188 | return $ipAddress; |
|
| 189 | } |
|
| 190 | ||
| 191 | /** |
|
| 192 | * |
|
| @@ 196-211 (lines=16) @@ | ||
| 193 | * @param PhysicalHostDetails $vmDetails |
|
| 194 | * @return string |
|
| 195 | */ |
|
| 196 | public function determineHostname($vmDetails) |
|
| 197 | { |
|
| 198 | // what are we doing? |
|
| 199 | $log = usingLog()->startAction("determine hostname of physical host '{$vmDetails->hostId}'"); |
|
| 200 | ||
| 201 | // create an adapter to talk to the host operating system |
|
| 202 | $host = OsLib::getHostAdapter($this->st, $vmDetails->osName); |
|
| 203 | ||
| 204 | // get the hostname |
|
| 205 | $hostname = $host->determineHostname($vmDetails, $this); |
|
| 206 | $vmDetails->hostname = $hostname; |
|
| 207 | ||
| 208 | // all done |
|
| 209 | $log->endAction("hostname is '{$hostname}'"); |
|
| 210 | return $hostname; |
|
| 211 | } |
|
| 212 | } |
|
| 213 | ||
| @@ 380-394 (lines=15) @@ | ||
| 377 | * @param stdClass $vmDetails |
|
| 378 | * @return string |
|
| 379 | */ |
|
| 380 | public function determineIpAddress($vmDetails) |
|
| 381 | { |
|
| 382 | // what are we doing? |
|
| 383 | $log = usingLog()->startAction("determine IP address of Vagrant VM '{$vmDetails->hostId}'"); |
|
| 384 | ||
| 385 | // create an adapter to talk to the host operating system |
|
| 386 | $host = OsLib::getHostAdapter($this->st, $vmDetails->osName); |
|
| 387 | ||
| 388 | // get the IP address |
|
| 389 | $ipAddress = $host->determineIpAddress($vmDetails, new VagrantVm($this->st)); |
|
| 390 | ||
| 391 | // all done |
|
| 392 | $log->endAction("IP address is '{$ipAddress}'"); |
|
| 393 | return $ipAddress; |
|
| 394 | } |
|
| 395 | ||
| 396 | /** |
|
| 397 | * |
|
| @@ 401-415 (lines=15) @@ | ||
| 398 | * @param stdClass $vmDetails |
|
| 399 | * @return string |
|
| 400 | */ |
|
| 401 | public function determineHostname($vmDetails) |
|
| 402 | { |
|
| 403 | // what are we doing? |
|
| 404 | $log = usingLog()->startAction("determine hostname of Vagrant VM '{$vmDetails->hostId}'"); |
|
| 405 | ||
| 406 | // create an adapter to talk to the host operating system |
|
| 407 | $host = OsLib::getHostAdapter($this->st, $vmDetails->osName); |
|
| 408 | ||
| 409 | // get the hostname |
|
| 410 | $hostname = $host->determineHostname($vmDetails, new VagrantVm($this->st)); |
|
| 411 | ||
| 412 | // all done |
|
| 413 | $log->endAction("hostname is '{$hostname}'"); |
|
| 414 | return $hostname; |
|
| 415 | } |
|
| 416 | ||
| 417 | /** |
|
| 418 | * Set the VAGRANT_BRIDGE_ADAPTER and VIRTUALBOX_BRIDGE_ADAPTER |
|
| @@ 75-93 (lines=19) @@ | ||
| 72 | /** |
|
| 73 | * @return object |
|
| 74 | */ |
|
| 75 | public function getDetails() |
|
| 76 | { |
|
| 77 | // what are we doing? |
|
| 78 | $log = usingLog()->startAction("retrieve details for host '{$this->args[0]}'"); |
|
| 79 | ||
| 80 | // get the host details |
|
| 81 | $hostDetails = $this->getHostDetails(); |
|
| 82 | ||
| 83 | // we already have details - are they valid? |
|
| 84 | if (isset($hostDetails->invalidHost) && $hostDetails->invalidHost) { |
|
| 85 | $msg = "there are no details about host '{$hostDetails->hostId}'"; |
|
| 86 | $log->endAction($msg); |
|
| 87 | throw Exceptions::newActionFailedException(__METHOD__, $msg); |
|
| 88 | } |
|
| 89 | ||
| 90 | // return the details |
|
| 91 | $log->endAction(); |
|
| 92 | return $hostDetails; |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * is a host up and running? |
|
| @@ 174-191 (lines=18) @@ | ||
| 171 | * @param string $packageName |
|
| 172 | * @return object |
|
| 173 | */ |
|
| 174 | public function getInstalledPackageDetails($packageName) |
|
| 175 | { |
|
| 176 | // what are we doing? |
|
| 177 | $log = usingLog()->startAction("get details for package '{$packageName}' installed on host '{$this->args[0]}'"); |
|
| 178 | ||
| 179 | // make sure we have valid host details |
|
| 180 | $hostDetails = $this->getHostDetails(); |
|
| 181 | ||
| 182 | // get an object to talk to this host |
|
| 183 | $host = OsLib::getHostAdapter($this->st, $hostDetails->osName); |
|
| 184 | ||
| 185 | // get the information |
|
| 186 | $return = $host->getInstalledPackageDetails($hostDetails, $packageName); |
|
| 187 | ||
| 188 | // all done |
|
| 189 | $log->endAction(); |
|
| 190 | return $return; |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * @param int $pid |
|