Module: PEBuild::Util::MachineComms
- Included in:
- Provisioner::PEAgent
- Defined in:
- lib/pe_build/util/machine_comms.rb
Overview
Utilities related to Vagrant Machine communications
This module provides general-purpose utility functions for communicating with Vagrant machines.
Defined Under Namespace
Classes: MachineNotReachable
Class Method Summary collapse
-
.ensure_reachable(machine) ⇒ void
Raise an error if Vagrant commands cannot be executed on a machine.
-
.is_reachable?(machine) ⇒ true, false
Determine if commands can be executed on a Vagrant machine.
Class Method Details
.ensure_reachable(machine) ⇒ void
This method returns an undefined value.
Raise an error if Vagrant commands cannot be executed on a machine
This function raises an error if a given vagrant machine is not ready for communication.
44 45 46 |
# File 'lib/pe_build/util/machine_comms.rb', line 44 def ensure_reachable(machine) raise MachineNotReachable, :vm_name => machine.name.to_s unless is_reachable?(machine) end |
.is_reachable?(machine) ⇒ true, false
Determine if commands can be executed on a Vagrant machine
19 20 21 22 23 24 25 26 27 |
# File 'lib/pe_build/util/machine_comms.rb', line 19 def is_reachable?(machine) begin machine.communicate.ready? rescue Vagrant::Errors::VagrantError # WinRM will raise an error if the VM isn't running instead of # returning false (GH-6356). false end end |