class Kitchen::Driver::Vmpool
Public Instance Methods
create(state)
click to toggle source
(see Base#create)
# File lib/kitchen/driver/vmpool.rb, line 43 def create(state) member = store.take_pool_member(config[:pool_name]) info("Pool member #{member} was selected") state[:hostname] = member end
destroy(state)
click to toggle source
(see Base#destroy)
# File lib/kitchen/driver/vmpool.rb, line 50 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
Private Instance Methods
store()
click to toggle source
@return [Hash] - a store hash that contains one or more pools
# File lib/kitchen/driver/vmpool.rb, line 69 def store @store ||= begin # load the store adapter and create a new instance of the store name = config[:state_store].split('_').map(&:capitalize).join('') store = sprintf("%s%s", name, 'Store') store_file = "#{config[:state_store]}_store" require "kitchen/driver/vmpool_stores/#{store_file}" klass = Object.const_get("Kitchen::Driver::VmpoolStores::#{store}") # create a new instance of the store with the provided options store_opts = config[:store_options] # convert everything key to strings store_opts.tap do |h| h.keys.each { |k| h[k.to_s] = h.delete(k) } end klass.send(:new, store_opts) end end