Class: VagrantPlugins::Vmck::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vmck/provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(machine) ⇒ Provider

Returns a new instance of Provider.



8
9
10
11
# File 'lib/vagrant-vmck/provider.rb', line 8

def initialize(machine)
  @machine = machine
  @logger = Log4r::Logger.new("vagrant_vmck::provider")
end

Instance Method Details

#action(name) ⇒ Object



13
14
15
16
# File 'lib/vagrant-vmck/provider.rb', line 13

def action(name)
  return Action.send(name) if Action.respond_to?(name)
  nil
end

#ssh_infoObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-vmck/provider.rb', line 18

def ssh_info
  env = @machine.action('read_job', lock: false)
  job = env[:vmck_job]

  return nil unless job['ready_for_ssh']

  return {
    :host => job['ssh']['host'],
    :port => job['ssh']['port'],
    :username => job['ssh']['username'],
    :private_key_path => @machine.provider_config.private_key_path,
  }
end

#stateObject



32
33
34
35
36
37
# File 'lib/vagrant-vmck/provider.rb', line 32

def state
  env = @machine.action('read_job', lock: false)
  state = env[:vmck_job]['state']
  long = short = state.to_s
  Vagrant::MachineState.new(state, short, long)
end