Class: Chef::Knife::Cloud::BootstrapCommand

Inherits:
Bootstrap
  • Object
show all
Includes:
Helpers
Defined in:
lib/chef/knife/cloud/command_bootstrap.rb

Direct Known Subclasses

ServerCreateCommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#after_exec_command, #before_exec_command, #create_service_instance, #execute_command, #msg_pair, #pretty_key, #set_default_config, #validate!, #validate_params!

Instance Attribute Details

#custom_argumentsObject

Returns the value of attribute custom_arguments.



29
30
31
# File 'lib/chef/knife/cloud/command_bootstrap.rb', line 29

def custom_arguments
  @custom_arguments
end

#serviceObject

Returns the value of attribute service.



29
30
31
# File 'lib/chef/knife/cloud/command_bootstrap.rb', line 29

def service
  @service
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/chef/knife/cloud/command_bootstrap.rb', line 31

def run
  # Set dafult config
  set_default_config

  # validate compulsory params
  validate!

  # validate command pre-requisites (cli options)
  validate_params!

  # setup the service
  @service = create_service_instance

  service.ui = ui # for interactive user prompts/messages

  # Perform any steps before handling the command
  before_exec_command

  # exec the actual cmd
  execute_command

  # Perform any steps after handling the command
  after_exec_command
rescue CloudExceptions::KnifeCloudError => e
  Chef::Log.debug(e.message)
  exit 1
end