class Chef::Knife::Cloud::Bootstrapper
Public Class Methods
new(config)
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb, line 31 def initialize(config) @config = config @ui ||= Chef::Knife::UI.new(STDOUT, STDERR, STDIN, {}) end
Public Instance Methods
bootstrap()
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb, line 36 def bootstrap # uses BootstrapDistribution and BootstrapProtocol to perform bootstrap @protocol = create_bootstrap_protocol @distribution = create_bootstrap_distribution begin @protocol.send_bootstrap_command rescue Net::SSH::AuthenticationFailed => e error_message = "Authentication Failed during bootstrapping. #{e.message}." raise CloudExceptions::BootstrapError, error_message end end
create_bootstrap_distribution()
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb, line 61 def create_bootstrap_distribution if @config[:image_os_type] == "windows" || @config[:image_os_type] == "linux" Chef::Knife::Cloud::BootstrapDistribution.new(@config) else # raise an exception, invalid bootstrap distribution. error_message = "Invalid bootstrap distribution. image_os_type should be either windows or linux." ui.fatal(error_message) raise CloudExceptions::BootstrapError, error_message end end
create_bootstrap_protocol()
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb, line 48 def create_bootstrap_protocol if @config[:connection_protocol].nil? || @config[:connection_protocol] == "ssh" SshBootstrapProtocol.new(@config) elsif @config[:connection_protocol] == "winrm" WinrmBootstrapProtocol.new(@config) else # raise an exception, invalid bootstrap protocol. error_message = "Invalid bootstrap protocol." ui.fatal(error_message) raise CloudExceptions::BootstrapError, error_message end end