Class: Kitchen::Driver::Vmpool

Inherits:
Base
  • Object
show all
Includes:
Logging
Defined in:
lib/kitchen/driver/vmpool.rb

Instance Method Summary collapse

Instance Method Details

#create(state) ⇒ Object



44
45
46
47
48
# File 'lib/kitchen/driver/vmpool.rb', line 44

def create(state)
  member = store.take_pool_member(config[:pool_name])
  info("Pool member #{member} was selected")
  state[:hostname] = member
end

#destroy(state) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/kitchen/driver/vmpool.rb', line 51

def destroy(state)
  return unless state[:hostname]

  opts = {
      pool_member: state[:hostname],
      pool_name: config[:pool_name],
      reuse_instances: config[:reuse_instances],
  }

  store.cleanup(**opts) do |host, used_status|
    info("Marking pool member #{host} as #{used_status}")
  end

  state.delete(:hostname)
end