Class: Chef::Knife::BootstrapWindowsWinrm

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

Instance Method Summary collapse

Methods included from WinrmBase

included

Methods included from BootstrapWindowsBase

#bootstrap, included, #load_template, #render_template

Instance Method Details

#runObject



40
41
42
# File 'lib/chef/knife/bootstrap_windows_winrm.rb', line 40

def run
  bootstrap
end

#run_command(command = '') ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/chef/knife/bootstrap_windows_winrm.rb', line 45

def run_command(command = '')
  winrm = Chef::Knife::Winrm.new
  winrm.name_args = [ server_name, command ]
  winrm.config[:winrm_user] = locate_config_value(:winrm_user)
  winrm.config[:winrm_password] = locate_config_value(:winrm_password)
  winrm.config[:winrm_transport] = locate_config_value(:winrm_transport)
  winrm.config[:kerberos_keytab_file] = Chef::Config[:knife][:kerberos_keytab_file] if Chef::Config[:knife][:kerberos_keytab_file]
  winrm.config[:kerberos_realm] = Chef::Config[:knife][:kerberos_realm] if Chef::Config[:knife][:kerberos_realm]
  winrm.config[:kerberos_service] = Chef::Config[:knife][:kerberos_service] if Chef::Config[:knife][:kerberos_service]
  winrm.config[:ca_trust_file] = Chef::Config[:knife][:ca_trust_file] if Chef::Config[:knife][:ca_trust_file]
  winrm.config[:manual] = true
  winrm.config[:winrm_port] = locate_config_value(:winrm_port)
  winrm.config[:suppress_auth_failure] = true
 
  #If you turn off the return flag, then winrm.run won't atually check and 
  #return the error
  #codes.  Otherwise, it ignores the return value of the server call.  
  winrm.config[:returns] = "0"
  winrm.run
end