Class: Chef::Knife::SoloPrepare

Inherits:
Chef::Knife show all
Includes:
KnifeSolo::NodeConfigCommand, KnifeSolo::SshCommand
Defined in:
lib/chef/knife/solo_prepare.rb

Overview

Approach ported from littlechef (github.com/tobami/littlechef) Copyright 2010, 2011, Miquel Torres <[email protected]>

Direct Known Subclasses

Prepare

Instance Method Summary collapse

Methods included from KnifeSolo::NodeConfigCommand

#generate_node_config, included, load_deps, #node_config, #node_environment, #node_name, #nodes_path

Methods included from KnifeSolo::SshCommand

#ask_password, #config_file_options, #config_files, #connection_options, #custom_sudo_command, #detect_authentication_method, #first_cli_arg_is_a_hostname?, #host, #host_descriptor, #identity_file, included, load_deps, #password, #process_startup_file, #process_sudo, #processed_command, #run_command, #run_portable_mkdir_p, #run_with_fallbacks, #ssh_args, #ssh_connection, #ssh_control_path, #standard_sudo_command, #startup_script, #stream_command, #sudo_available?, #sudo_command, #try_connection, #user, #validate_ssh_options!, #windows_node?

Instance Method Details

#bootstrapObject



65
66
67
68
# File 'lib/chef/knife/solo_prepare.rb', line 65

def bootstrap
  ui.msg "Bootstrapping Chef..."
  KnifeSolo::Bootstraps.class_for_operating_system(operating_system).new(self)
end

#chef_versionObject



74
75
76
77
78
79
80
# File 'lib/chef/knife/solo_prepare.rb', line 74

def chef_version
  if (v = Chef::Config[:knife][:bootstrap_version])
    v.empty? ? nil : v
  else
    Chef::VERSION
  end
end

#operating_systemObject



70
71
72
# File 'lib/chef/knife/solo_prepare.rb', line 70

def operating_system
  run_command('uname -s').stdout.strip
end

#runObject



50
51
52
53
54
55
56
57
58
59
# File 'lib/chef/knife/solo_prepare.rb', line 50

def run
  if config[:omnibus_version]
    ui.warn '`--omnibus-version` is deprecated, please use `--bootstrap-version`.'
    Chef::Config[:knife][:bootstrap_version] = config[:omnibus_version]
  end

  validate!
  bootstrap.bootstrap!
  generate_node_config
end

#validate!Object



61
62
63
# File 'lib/chef/knife/solo_prepare.rb', line 61

def validate!
  validate_ssh_options!
end