lib/kitchen/provisioner/finder/winrm.rb in kitchen-nodes-0.7.0 vs lib/kitchen/provisioner/finder/winrm.rb in kitchen-nodes-0.8.0
- old
+ new
@@ -3,11 +3,11 @@
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)
+ unelevated_session.run(command, &block)
end
end
end
end
@@ -21,11 +21,12 @@
@connection = connection
end
def find_ips
out = @connection.node_execute(
- '(ipconfig) -match \'IPv[46] Address\'')
+ '(ipconfig) -match \'IPv[46] Address\''
+ )
data = []
out[:data].each do |out_data|
stdout = out_data[:stdout]
data << Regexp.last_match[1] if stdout.chomp =~ /:\s*(\S+)/
end
@@ -38,13 +39,10 @@
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 = out.stdout.chomp unless out.stdout.nil?
data
end
end
end
end