class Chef::Knife::Cloud::WinrmBootstrapProtocol
Public Class Methods
new(config)
click to toggle source
Calls superclass method
Chef::Knife::Cloud::BootstrapProtocol::new
# File lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb, line 27 def initialize(config) load_winrm_deps @bootstrap = Chef::Knife::Bootstrap.new super end
Public Instance Methods
init_bootstrap_options()
click to toggle source
Calls superclass method
Chef::Knife::Cloud::BootstrapProtocol#init_bootstrap_options
# File lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb, line 38 def init_bootstrap_options bootstrap.config[:connection_user] = @config[:connection_user] || "Administrator" bootstrap.config[:connection_password] = @config[:connection_password] bootstrap.config[:winrm_ssl] = @config[:winrm_ssl] bootstrap.config[:connection_port] = @config[:connection_port] bootstrap.config[:auth_timeout] = @config[:auth_timeout] bootstrap.config[:winrm_ssl_verify_mode] = @config[:winrm_ssl_verify_mode] bootstrap.config[:connection_protocol] = @config[:connection_protocol] super end
load_winrm_deps()
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb, line 33 def load_winrm_deps require "winrm" unless defined?(WinRM::Connection) require "chef/knife/core/windows_bootstrap_context" end
tcp_test_winrm(hostname, port)
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb, line 57 def tcp_test_winrm(hostname, port) tcp_socket = TCPSocket.new(hostname, port) true rescue SocketError sleep 2 false rescue Errno::ETIMEDOUT false rescue Errno::EPERM false rescue Errno::ECONNREFUSED sleep 2 false rescue Errno::EHOSTUNREACH sleep 2 false rescue Errno::ENETUNREACH sleep 2 false ensure tcp_socket && tcp_socket.close end
wait_for_server_ready()
click to toggle source
# File lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb, line 49 def wait_for_server_ready print "\n#{ui.color("Waiting for winrm to host (#{@config[:bootstrap_ip_address]})", :magenta)}" print(".") until tcp_test_winrm(@config[:bootstrap_ip_address], @config[:connection_port]) do sleep @initial_sleep_delay ||= 10 puts("done") end end