Sha256: 1f2994006551a8a6cc56067cc3961a16a979547c4202bbcd5b0a0abe244bb36c
Contents?: true
Size: 1.34 KB
Versions: 5
Compression:
Stored size: 1.34 KB
Contents
module Kitchen module Transport class Winrm < Kitchen::Transport::Base # Monkey patch of test-kitchen winrm transport # that returns stdout class Connection < Kitchen::Transport::Base::Connection def node_execute(command, &block) session.run_powershell_script(command, &block) end end end end module Provisioner module Finder # WinRM implementation for returning active non-localhost IPs class Winrm def initialize(connection) @connection = connection end def find_ips out = @connection.node_execute( 'Get-NetIPConfiguration | % { $_.ipv4address.IPAddress }') data = [] out[:data].each do |out_data| stdout = out_data[:stdout] data << stdout.chomp unless stdout.nil? end data end def find_fqdn out = @connection.node_execute <<-EOS [System.Net.Dns]::GetHostByName($env:computername) | FL HostName | Out-String | % { \"{0}\" -f $_.Split(':')[1].Trim() } EOS data = '' out[:data].each do |out_data| stdout = out_data[:stdout] data << stdout.chomp unless stdout.nil? end data end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems