Class: RemoteKVM::RemotekvmCreate

Inherits:
Chef::Knife
  • Object
show all
Includes:
Helpers
Defined in:
lib/chef/knife/remotekvm_create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ RemotekvmCreate

Returns a new instance of RemotekvmCreate.



126
127
128
129
# File 'lib/chef/knife/remotekvm_create.rb', line 126

def initialize(*args)
  super
  config[:distro] = 'chef-full'
end

Instance Attribute Details

#kvm_nameObject (readonly)

Returns the value of attribute kvm_name.



124
125
126
# File 'lib/chef/knife/remotekvm_create.rb', line 124

def kvm_name
  @kvm_name
end

Instance Method Details

#runObject



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/chef/knife/remotekvm_create.rb', line 131

def run
  tries = 5
  @kvm_name = config[:chef_node_name] = name_args.first
  ip_address = create_new_container
  begin
    bootstrap_container(ip_address)
  rescue Errno::EHOSTUNREACH
    if(tries > 0)
      tries -= 1
      puts "Failed to connect. Will wait and retry (#{tries} retries remaining)"
      retry
    else
      raise
    end
  end
end