Class: Kitchen::Provisioner::Dokken

Inherits:
ChefZero
  • Object
show all
Defined in:
lib/kitchen/provisioner/dokken.rb

Overview

Author:

Instance Method Summary collapse

Instance Method Details

#call(state) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/kitchen/provisioner/dokken.rb', line 40

def call(state)
  create_sandbox
  instance.transport.connection(state) do |conn|
    conn.execute(run_command)
  end
rescue Kitchen::Transport::TransportFailed => ex
  raise ActionFailed, ex.message
  # ensure
  #   cleanup_sandbox
end

#validate_configObject



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

def validate_config
  # check if we have an space for the user provided options
  # or add it if not to avoid issues
  unless config[:chef_options].start_with? ' '
    config[:chef_options].prepend(' ')
  end

  # strip spaces from all other options
  config[:chef_binary] = config[:chef_binary].strip
  config[:chef_log_level] = config[:chef_log_level].strip
  config[:chef_output_format] = config[:chef_output_format].strip

  # if the user wants to be funny and pass empty strings
  # just use the defaults
  config[:chef_log_level] = 'warn' if config[:chef_log_level].empty?
  config[:chef_output_format] = 'doc' if config[:chef_output_format].empty?
end