Class: Chef::Knife::BootstrapWindowsWinrm

Inherits:
Bootstrap
  • Object
show all
Includes:
BootstrapWindowsBase, WinrmBase, WinrmCommandSharedFunctions
Defined in:
lib/chef/knife/bootstrap_windows_winrm.rb

Instance Method Summary collapse

Methods included from WinrmCommandSharedFunctions

included

Methods included from WinrmBase

included

Methods included from BootstrapWindowsBase

#bootstrap, #bootstrap_context, #bootstrap_template, #default_bootstrap_template, included, #load_correct_secret, #load_template, #render_template

Methods included from KnifeWindowsBase

#locate_config_value

Instance Method Details

#runObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/chef/knife/bootstrap_windows_winrm.rb', line 42

def run       
  if (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key])))
    if !negotiate_auth? && !(locate_config_value(:winrm_transport) == 'ssl')
      ui.error('Validatorless bootstrap over unsecure winrm channels could expose your key to network sniffing')
      exit 1
    end
  end

  validate_winrm_options!
  resolve_session_options
  @session_opts[:host] = server_name
  @session = Chef::Knife::WinrmSession.new(@session_opts)

  bootstrap
end

#run_command(command = '') ⇒ Object



58
59
60
61
# File 'lib/chef/knife/bootstrap_windows_winrm.rb', line 58

def run_command(command = '')
  @session.relay_command(command)
  return @session.exit_code
end