Method: CloudFlock::App::Common#provision_compute

Defined in:
lib/cloudflock/app/common/servers.rb

#provision_compute(api, managed, compute_spec) ⇒ Object

Public: Create a new compute instance via API.

api - Authenticated Fog API instance. managed - Whether the instance is expected to be managed (if

Rackspace public cloud).

compute_spec - Hash containing parameters to pass via the API call.

Returns a Hash with information necessary to log in to the new host.



294
295
296
297
298
299
300
301
302
303
304
# File 'lib/cloudflock/app/common/servers.rb', line 294

def provision_compute(api, managed, compute_spec)
  host = api.servers.create(compute_spec)
  provision_wait(host, compute_spec[:name])
  managed_wait(host) if managed
  rescue_compute(host)

  { username: 'root', port: '22' }.merge(get_host_details(host))
rescue Fog::Errors::TimeoutError, Excon::Errors::Timeout
  retry if retry_prompt('Provisioning failed.')
  exit
end