class Kitchen::Driver::VmpoolStores::FileStore

Public Class Methods

new(options = nil) click to toggle source

@option pool_file [String] - the file path that holds the pool information

# File lib/kitchen/driver/vmpool_stores/file_store.rb, line 11
def initialize(options = nil)
  raise ArgumentError unless options['pool_file']
  options ||= { 'pool_file' => 'vmpool.yaml' }
  @pool_file = options['pool_file']
end

Private Instance Methods

base_content() click to toggle source
# File lib/kitchen/driver/vmpool_stores/file_store.rb, line 19
def base_content
  {
    pool1: {
      size: 1,
      pool_instances: [],
      used_instances: [],
      requests: []
    }
  }
end
read_content() click to toggle source
# File lib/kitchen/driver/vmpool_stores/file_store.rb, line 30
def read_content
  data = File.read(pool_file)
  raise ArgumentError unless data
  data
end
write_content(content = pool_data) click to toggle source
# File lib/kitchen/driver/vmpool_stores/file_store.rb, line 36
def write_content(content = pool_data)
  File.open(pool_file, 'w') { |f| f.write(content.to_yaml) }
end