class Kitchen::Driver::Gogetit

Gogetit driver for Kitchen.

@author Don Draper <donoldfashioned@gmail.com>

Public Instance Methods

choose_provider(provider) click to toggle source
# File lib/kitchen/driver/gogetit.rb, line 62
def choose_provider(provider)
  case provider
  when 'lxd'
    Gogetit.lxd
  when 'libvirt'
    Gogetit.libvirt
  end
end
create(state) click to toggle source
# File lib/kitchen/driver/gogetit.rb, line 39
def create(state)
  options = { 'alias' => config[:template] } if config[:template]
  provider = choose_provider(config[:provider])
  result = provider.create(instance.name, options)
  domain = Gogetit.maas.get_domain
  state[:hostname]      = instance.name + '.' + domain
  state[:username]      = result[:info][:default_user]
                          info 'Waiting for the new domain to be available..'
  wait_until_available(instance.name)

                          info 'Waiting for SSH..'
  conn = instance.transport.connection(state)
  conn.wait_until_ready
  conn.close
end
destroy(state) click to toggle source
# File lib/kitchen/driver/gogetit.rb, line 55
def destroy(state)
  provider = choose_provider(config[:provider])
  provider.destroy(instance.name)

  instance.transport.connection(state).close
end
wait_until_available(hostname) click to toggle source
# File lib/kitchen/driver/gogetit.rb, line 71
def wait_until_available(hostname)
  until Gogetit.maas.domain_name_exists?(hostname)
    sleep 3
  end
end