Class: VagrantPlugins::AVF::Provider
- Inherits:
-
Object
- Object
- VagrantPlugins::AVF::Provider
- Defined in:
- lib/vagrant_provider_avf/provider.rb
Class Method Summary collapse
Instance Method Summary collapse
- #action(name) ⇒ Object
-
#initialize(machine, driver_factory: ->(current_machine) { Driver.new( machine_metadata_store: MachineMetadataStore.new(current_machine), machine_data_dir: current_machine.data_dir ) }) ⇒ Provider
constructor
A new instance of Provider.
- #ssh_info ⇒ Object
- #state ⇒ Object
Constructor Details
#initialize(machine, driver_factory: ->(current_machine) { Driver.new( machine_metadata_store: MachineMetadataStore.new(current_machine), machine_data_dir: current_machine.data_dir ) }) ⇒ Provider
Returns a new instance of Provider.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vagrant_provider_avf/provider.rb', line 11 def initialize( machine, driver_factory: ->(current_machine) { Driver.new( machine_metadata_store: MachineMetadataStore.new(current_machine), machine_data_dir: current_machine.data_dir ) } ) @machine = machine @driver_factory = driver_factory end |
Class Method Details
.usable?(raise_error = false, host_platform: HostPlatform.current) ⇒ Boolean
4 5 6 7 8 9 |
# File 'lib/vagrant_provider_avf/provider.rb', line 4 def self.usable?(raise_error = false, host_platform: HostPlatform.current) return true if host_platform.supported? return false unless raise_error raise Errors::UnsupportedHost.new(host_platform) end |
Instance Method Details
#action(name) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vagrant_provider_avf/provider.rb', line 24 def action(name) case name.to_sym when :read_state Action.action_read_state(@machine, driver_factory: @driver_factory) when :ssh Action.action_ssh when :ssh_run Action.action_ssh_run when :ssh_info Action.action_ssh_info(@machine, driver_factory: @driver_factory) when :up Action.action_up(@machine, driver_factory: @driver_factory) when :halt Action.action_halt(@machine, driver_factory: @driver_factory) when :destroy Action.action_destroy(@machine, driver_factory: @driver_factory) end end |
#ssh_info ⇒ Object
43 44 45 46 47 48 |
# File 'lib/vagrant_provider_avf/provider.rb', line 43 def ssh_info env = @machine.action(:ssh_info) return unless env.is_a?(Hash) env[:machine_ssh_info] end |
#state ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/vagrant_provider_avf/provider.rb', line 50 def state env = @machine.action(:read_state) return env.fetch(:machine_state) if env.is_a?(Hash) raise Errors::MissingMachineState rescue KeyError raise Errors::MissingMachineState end |