Class: VagrantPlugins::Skytap::SetupHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/setup_helper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, environment) ⇒ SetupHelper

Returns a new instance of SetupHelper.



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/vagrant-skytap/setup_helper.rb', line 39

def initialize(env, environment)
  @env = env
  @logger = Log4r::Logger.new("vagrant_skytap::setup_helper")
  @environment = environment
  @host_vm = env[:vagrant_host_vm]
  @machine = env[:machine]
  @provider_config = env[:machine].provider_config
  @username = @machine.config.ssh.username
  @password = @machine.config.ssh.password
  @host = @machine.config.ssh.host
  @port = @machine.config.ssh.port || Net::SSH::Transport::Session::DEFAULT_PORT
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



32
33
34
# File 'lib/vagrant-skytap/setup_helper.rb', line 32

def env
  @env
end

#environmentObject (readonly)

Returns the value of attribute environment.



32
33
34
# File 'lib/vagrant-skytap/setup_helper.rb', line 32

def environment
  @environment
end

#hostObject (readonly)

Returns the value of attribute host.



33
34
35
# File 'lib/vagrant-skytap/setup_helper.rb', line 33

def host
  @host
end

#host_vmObject (readonly)

Returns the value of attribute host_vm.



32
33
34
# File 'lib/vagrant-skytap/setup_helper.rb', line 32

def host_vm
  @host_vm
end

#machineObject (readonly)

Returns the value of attribute machine.



32
33
34
# File 'lib/vagrant-skytap/setup_helper.rb', line 32

def machine
  @machine
end

#passwordObject (readonly)

Returns the value of attribute password.



33
34
35
# File 'lib/vagrant-skytap/setup_helper.rb', line 33

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



33
34
35
# File 'lib/vagrant-skytap/setup_helper.rb', line 33

def port
  @port
end

#provider_configObject (readonly)

Returns the value of attribute provider_config.



32
33
34
# File 'lib/vagrant-skytap/setup_helper.rb', line 32

def provider_config
  @provider_config
end

#usernameObject (readonly)

Returns the value of attribute username.



33
34
35
# File 'lib/vagrant-skytap/setup_helper.rb', line 33

def username
  @username
end

Class Method Details

.run!(env, environment) ⇒ Object



35
36
37
# File 'lib/vagrant-skytap/setup_helper.rb', line 35

def self.run!(env, environment)
  new(env, environment).run!
end

Instance Method Details

#current_vmObject



52
53
54
55
56
# File 'lib/vagrant-skytap/setup_helper.rb', line 52

def current_vm
  if @environment && @machine
    @environment.get_vms_by_id([@machine.id]).first
  end
end

#run!Object



62
63
64
65
66
# File 'lib/vagrant-skytap/setup_helper.rb', line 62

def run!
  ask_routing
  ask_credentials
  write_properties
end

#running_in_skytap_vm?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/vagrant-skytap/setup_helper.rb', line 58

def running_in_skytap_vm?
  !!host_vm
end