Class: Chef::Knife::BootstrapWindowsWinRM

Inherits:
Bootstrap
  • Object
show all
Includes:
BootstrapWindowsCore, WinrmCommandCommon, WinrmCore
Defined in:
lib/chef/knife/winops_bootstrap_windows_winrm.rb

Instance Method Summary collapse

Methods included from WinrmCommandCommon

included

Methods included from WinrmCore

included

Methods included from BootstrapWindowsCore

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

Methods included from KnifeWindowsCore

#locate_config_value

Instance Method Details

#runObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/chef/knife/winops_bootstrap_windows_winrm.rb', line 42

def run
  validate_name_args!

  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

  unless locate_config_value(:winrm_shell) == :cmd
    ui.warn("The cmd shell is the only valid winrm-shell for 'knife bootstrap windows winrm'. Switching to the cmd shell.")
    config[:winrm_shell] = :cmd
  end

  config[:manual] = true
  configure_session

  bootstrap
end