winrm 1.2.0 → 1.3.0.dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -8
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/bin/rwinrm +89 -0
- data/lib/winrm/exceptions/exceptions.rb +36 -26
- data/lib/winrm/helpers/iso8601_duration.rb +13 -17
- data/lib/winrm/http/response_handler.rb +70 -0
- data/lib/winrm/http/transport.rb +70 -43
- data/lib/winrm/soap_provider.rb +15 -19
- data/lib/winrm/winrm_service.rb +145 -132
- data/lib/winrm.rb +27 -19
- data/spec/auth_timeout_spec.rb +15 -0
- data/spec/cmd_spec.rb +44 -22
- data/spec/exception_spec.rb +35 -0
- data/spec/matchers.rb +72 -0
- data/spec/powershell_spec.rb +54 -6
- data/spec/response_handler_spec.rb +44 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/stubs/responses/open_shell_v1.xml +19 -0
- data/spec/stubs/responses/open_shell_v2.xml +20 -0
- data/spec/stubs/responses/soap_fault_v1.xml +36 -0
- data/spec/stubs/responses/soap_fault_v2.xml +42 -0
- data/spec/winrm_primitives_spec.rb +6 -6
- data/spec/wql_spec.rb +6 -3
- data/winrm.gemspec +8 -7
- metadata +51 -29
- data/spec/nori_type_casting_spec.rb +0 -28
- data/spec/test.ps1 +0 -14
data/spec/matchers.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
module WinRMSpecs
|
4
|
+
def self.stdout(output)
|
5
|
+
output[:data].collect do |i|
|
6
|
+
i[:stdout]
|
7
|
+
end.join('\r\n').gsub(/(\\r\\n)+$/, '')
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.stderr(output)
|
11
|
+
output[:data].collect do |i|
|
12
|
+
i[:stderr]
|
13
|
+
end.join('\r\n').gsub(/(\\r\\n)+$/, '')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
RSpec::Matchers.define :have_stdout_match do |expected_stdout|
|
18
|
+
match do |actual_output|
|
19
|
+
expected_stdout.match(WinRMSpecs.stdout(actual_output)) != nil
|
20
|
+
end
|
21
|
+
failure_message do |actual_output|
|
22
|
+
"expected that '#{WinRMSpecs.stdout(actual_output)}' would match #{expected_stdout}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
RSpec::Matchers.define :have_stderr_match do |expected_stderr|
|
27
|
+
match do |actual_output|
|
28
|
+
expected_stderr.match(WinRMSpecs.stderr(actual_output)) != nil
|
29
|
+
end
|
30
|
+
failure_message do |actual_output|
|
31
|
+
"expected that '#{WinRMSpecs.stderr(actual_output)}' would match #{expected_stderr}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Matchers.define :have_no_stdout do
|
36
|
+
match do |actual_output|
|
37
|
+
stdout = WinRMSpecs.stdout(actual_output)
|
38
|
+
stdout == '\r\n' || stdout == ''
|
39
|
+
end
|
40
|
+
failure_message do |actual_output|
|
41
|
+
"expected that '#{WinRMSpecs.stdout(actual_output)}' would have no stdout"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
RSpec::Matchers.define :have_no_stderr do
|
46
|
+
match do |actual_output|
|
47
|
+
stderr = WinRMSpecs.stderr(actual_output)
|
48
|
+
stderr == '\r\n' || stderr == ''
|
49
|
+
end
|
50
|
+
failure_message do |actual_output|
|
51
|
+
"expected that '#{WinRMSpecs.stderr(actual_output)}' would have no stderr"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
RSpec::Matchers.define :have_exit_code do |expected_exit_code|
|
56
|
+
match do |actual_output|
|
57
|
+
expected_exit_code == actual_output[:exitcode]
|
58
|
+
end
|
59
|
+
failure_message do |actual_output|
|
60
|
+
"expected exit code #{expected_exit_code}, but got #{actual_output[:exitcode]}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
RSpec::Matchers.define :be_a_uid do
|
65
|
+
match do |actual|
|
66
|
+
# WinRM1.1 returns uuid's prefixed with 'uuid:' where as later versions do not
|
67
|
+
actual != nil && actual.match(/^(uuid:)*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/)
|
68
|
+
end
|
69
|
+
failure_message do |actual|
|
70
|
+
"expected a uid, but got '#{actual}'"
|
71
|
+
end
|
72
|
+
end
|
data/spec/powershell_spec.rb
CHANGED
@@ -1,12 +1,60 @@
|
|
1
|
-
describe
|
1
|
+
describe 'winrm client powershell', :integration => true do
|
2
2
|
before(:all) do
|
3
3
|
@winrm = winrm_connection
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
describe 'empty string' do
|
7
|
+
subject(:output) { @winrm.powershell('') }
|
8
|
+
it { should have_exit_code 4294770688 }
|
9
|
+
it { should have_stderr_match /Cannot process the command because of a missing parameter/ }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'ipconfig' do
|
13
|
+
subject(:output) { @winrm.powershell('ipconfig') }
|
14
|
+
it { should have_exit_code 0 }
|
15
|
+
it { should have_stdout_match /Windows IP Configuration/ }
|
16
|
+
it { should have_no_stderr }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'echo \'hello world\' using apostrophes' do
|
20
|
+
subject(:output) { @winrm.powershell("echo 'hello world'") }
|
21
|
+
it { should have_exit_code 0 }
|
22
|
+
it { should have_stdout_match /hello world/ }
|
23
|
+
it { should have_no_stderr }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'dir with incorrect argument /z' do
|
27
|
+
subject(:output) { @winrm.powershell('dir /z') }
|
28
|
+
it { should have_exit_code 1 }
|
29
|
+
it { should have_no_stdout }
|
30
|
+
#TODO Better
|
31
|
+
#it { should have_stderr_match /Invalid switch/ }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'Math area calculation' do
|
35
|
+
subject(:output) do
|
36
|
+
@winrm.powershell(<<-EOH
|
37
|
+
$diameter = 4.5
|
38
|
+
$area = [Math]::pow([Math]::PI * ($diameter/2), 2)
|
39
|
+
Write-Host $area
|
40
|
+
EOH
|
41
|
+
)
|
42
|
+
end
|
43
|
+
it { should have_exit_code 0 }
|
44
|
+
it { should have_stdout_match /49.9648722805149/ }
|
45
|
+
it { should have_no_stderr }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'ipconfig with a block' do
|
49
|
+
subject(:stdout) do
|
50
|
+
outvar = ''
|
51
|
+
@winrm.powershell('ipconfig') do |stdout, stderr|
|
52
|
+
outvar << stdout
|
53
|
+
end
|
54
|
+
outvar
|
55
|
+
end
|
56
|
+
it { should match(/Windows IP Configuration/) }
|
11
57
|
end
|
12
58
|
end
|
59
|
+
|
60
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'winrm/http/response_handler'
|
2
|
+
|
3
|
+
describe 'response handler', :unit => true do
|
4
|
+
|
5
|
+
['v1', 'v2'].each do |winrm_version|
|
6
|
+
let(:soap_fault) { File.read("spec/stubs/responses/soap_fault_#{winrm_version}.xml") }
|
7
|
+
let(:open_shell) { File.read("spec/stubs/responses/open_shell_#{winrm_version}.xml") }
|
8
|
+
|
9
|
+
describe "successful 200 #{winrm_version} response" do
|
10
|
+
it 'returns an xml doc' do
|
11
|
+
handler = WinRM::ResponseHandler.new(open_shell, 200)
|
12
|
+
xml_doc = handler.parse_to_xml()
|
13
|
+
expect(xml_doc).to be_instance_of(REXML::Document)
|
14
|
+
expect(xml_doc.to_s).to eq(REXML::Document.new(open_shell).to_s)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "failed 500 #{winrm_version} response" do
|
19
|
+
it 'raises a WinRMHTTPTransportError' do
|
20
|
+
handler = WinRM::ResponseHandler.new('', 500)
|
21
|
+
expect { handler.parse_to_xml()}.to raise_error(WinRM::WinRMHTTPTransportError)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "failed 401 #{winrm_version} response" do
|
26
|
+
it 'raises a WinRMAuthorizationError' do
|
27
|
+
handler = WinRM::ResponseHandler.new('', 401)
|
28
|
+
expect { handler.parse_to_xml()}.to raise_error(WinRM::WinRMAuthorizationError)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "failed 400 #{winrm_version} response" do
|
33
|
+
it 'raises a WinRMWSManFault' do
|
34
|
+
handler = WinRM::ResponseHandler.new(soap_fault, 400)
|
35
|
+
begin
|
36
|
+
handler.parse_to_xml()
|
37
|
+
rescue WinRM::WinRMWSManFault => e
|
38
|
+
expect(e.fault_code).to eq('2150858778')
|
39
|
+
expect(e.fault_description).to include('The specified class does not exist in the given namespace')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
<s:Envelope xml:lang='en-US' xmlns:s='http://www.w3.org/2003/05/soap-envelope' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'>
|
2
|
+
<s:Header>
|
3
|
+
<a:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse</a:Action>
|
4
|
+
<a:MessageID>uuid:94D35B73-3DD8-428D-9495-7AF3F0559428</a:MessageID>
|
5
|
+
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
|
6
|
+
<a:RelatesTo>uuid:EEF803CE-B9A6-48C1-BF00-90C6F077EC2A</a:RelatesTo>
|
7
|
+
</s:Header>
|
8
|
+
<s:Body>
|
9
|
+
<x:ResourceCreated xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:x='http://schemas.xmlsoap.org/ws/2004/09/transfer' xmlns:rsp='http://schemas.microsoft.com/wbem/wsman/1/windows/shell'>
|
10
|
+
<a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
|
11
|
+
<a:ReferenceParameters>
|
12
|
+
<w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
|
13
|
+
<w:SelectorSet>
|
14
|
+
<w:Selector Name='ShellId'>uuid:739990FF-1492-4CDD-80BB-6E07ADB06D85</w:Selector>
|
15
|
+
</w:SelectorSet>
|
16
|
+
</a:ReferenceParameters>
|
17
|
+
</x:ResourceCreated>
|
18
|
+
</s:Body>
|
19
|
+
</s:Envelope>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xml:lang="en-US">
|
3
|
+
<s:Header>
|
4
|
+
<a:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse</a:Action>
|
5
|
+
<a:MessageID>uuid:9FF5B7FE-CC97-4FA4-B51F-E4220C016AE7</a:MessageID>
|
6
|
+
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
|
7
|
+
<a:RelatesTo>uuid:EA2A7785-D8E6-4E28-8AD8-FC27156537B3</a:RelatesTo>
|
8
|
+
</s:Header>
|
9
|
+
<s:Body>
|
10
|
+
<x:ResourceCreated>
|
11
|
+
<a:Address>http://localhost:5985/wsman</a:Address>
|
12
|
+
<a:ReferenceParameters>
|
13
|
+
<w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
|
14
|
+
<w:SelectorSet>
|
15
|
+
<w:Selector Name="ShellId">62DE33F0-8674-43D9-B6A5-3298012CC4CD</w:Selector>
|
16
|
+
</w:SelectorSet>
|
17
|
+
</a:ReferenceParameters>
|
18
|
+
</x:ResourceCreated>
|
19
|
+
</s:Body>
|
20
|
+
</s:Envelope>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<s:Envelope xml:lang='en-US' xmlns:s='http://www.w3.org/2003/05/soap-envelope' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing' xmlns:x='http://schemas.xmlsoap.org/ws/2004/09/transfer' xmlns:e='http://schemas.xmlsoap.org/ws/2004/08/eventing' xmlns:n='http://schemas.xmlsoap.org/ws/2004/09/enumeration' xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'>
|
2
|
+
<s:Header>
|
3
|
+
<a:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/fault</a:Action>
|
4
|
+
<a:MessageID>uuid:AF8907B2-F47E-4DE5-A4AA-E1EC36EA0E49</a:MessageID>
|
5
|
+
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
|
6
|
+
<a:RelatesTo>uuid:B90EC4BB-4484-4ADA-920B-019517747915</a:RelatesTo>
|
7
|
+
</s:Header>
|
8
|
+
<s:Body>
|
9
|
+
<s:Fault>
|
10
|
+
<s:Code>
|
11
|
+
<s:Value>s:Sender</s:Value>
|
12
|
+
<s:Subcode>
|
13
|
+
<s:Value>n:CannotProcessFilter</s:Value>
|
14
|
+
</s:Subcode>
|
15
|
+
</s:Code>
|
16
|
+
<s:Reason>
|
17
|
+
<s:Text xml:lang='en-US'>
|
18
|
+
The data source could not process the filter. The filter might be
|
19
|
+
missing or it might be invalid. Change the filter and try the request
|
20
|
+
again.
|
21
|
+
</s:Text>
|
22
|
+
</s:Reason>
|
23
|
+
<s:Detail>
|
24
|
+
<f:WSManFault xmlns:f='http://schemas.microsoft.com/wbem/wsman/1/wsmanfault' Code='2150858778' Machine=''>
|
25
|
+
<f:Message>
|
26
|
+
<f:ProviderFault provider='WMIv1 plugin for Windows Remote Management ' path='%systemroot%\system32\WsmWmiPl.dll'>
|
27
|
+
<f:WSManFault xmlns:f='http://schemas.microsoft.com/wbem/wsman/1/wsmanfault' Code='2150858778' Machine='' xml:lang='en-US'>
|
28
|
+
<f:Message>The specified class does not exist in the given namespace. </f:Message>
|
29
|
+
</f:WSManFault>
|
30
|
+
</f:ProviderFault>
|
31
|
+
</f:Message>
|
32
|
+
</f:WSManFault>
|
33
|
+
</s:Detail>
|
34
|
+
</s:Fault>
|
35
|
+
</s:Body>
|
36
|
+
</s:Envelope>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<s:Envelope xml:lang="en-US" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer">
|
3
|
+
<s:Header>
|
4
|
+
<a:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/fault</a:Action>
|
5
|
+
<a:MessageID>uuid:CC816664-896D-46C7-9227-AE6E1231CE49</a:MessageID>
|
6
|
+
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
|
7
|
+
<a:RelatesTo>uuid:0CB1C49A-5054-4C12-AF30-FC60BE995DD9</a:RelatesTo>
|
8
|
+
</s:Header>
|
9
|
+
<s:Body>
|
10
|
+
<s:Fault>
|
11
|
+
<s:Code>
|
12
|
+
<s:Value>s:Sender</s:Value>
|
13
|
+
<s:Subcode>
|
14
|
+
<s:Value>n:CannotProcessFilter</s:Value>
|
15
|
+
</s:Subcode>
|
16
|
+
</s:Code>
|
17
|
+
<s:Reason>
|
18
|
+
<s:Text xml:lang="en-US">The data source could not process the filter. The filter might be missing or it might be invalid. Change the filter and try the request again. </s:Text>
|
19
|
+
</s:Reason>
|
20
|
+
<s:Detail>
|
21
|
+
<f:WSManFault Code="2150858778" Machine="localhost" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">
|
22
|
+
<f:Message>
|
23
|
+
<f:ProviderFault path="%systemroot%\system32\WsmWmiPl.dll" provider="WMI Provider">
|
24
|
+
<f:WSManFault Code="2150858778" Machine="vagrant-2008R2" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">
|
25
|
+
<f:Message>The specified class does not exist in the given namespace. </f:Message>
|
26
|
+
</f:WSManFault>
|
27
|
+
<f:ExtendedError>
|
28
|
+
<p:__ExtendedStatus xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/__ExtendedStatus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="p:__ExtendedStatus_Type">
|
29
|
+
<p:Description xsi:nil="true"/>
|
30
|
+
<p:Operation>ExecQuery</p:Operation>
|
31
|
+
<p:ParameterInfo>Select * from Win32_Processa where name="sshd.exe"</p:ParameterInfo>
|
32
|
+
<p:ProviderName>WinMgmt</p:ProviderName>
|
33
|
+
<p:StatusCode xsi:nil="true"/>
|
34
|
+
</p:__ExtendedStatus>
|
35
|
+
</f:ExtendedError>
|
36
|
+
</f:ProviderFault>
|
37
|
+
</f:Message>
|
38
|
+
</f:WSManFault>
|
39
|
+
</s:Detail>
|
40
|
+
</s:Fault>
|
41
|
+
</s:Body>
|
42
|
+
</s:Envelope>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe "
|
1
|
+
describe "winrm client primitives" do
|
2
2
|
before(:all) do
|
3
3
|
@winrm = winrm_connection
|
4
4
|
end
|
@@ -7,8 +7,7 @@ describe "Test WinRM primitive methods" do
|
|
7
7
|
|
8
8
|
it 'should #open_shell and #close_shell' do
|
9
9
|
sid = @winrm.open_shell
|
10
|
-
|
11
|
-
expect(sid).to match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/)
|
10
|
+
expect(sid).to be_a_uid
|
12
11
|
expect(@winrm.close_shell(sid)).to be true
|
13
12
|
end
|
14
13
|
|
@@ -16,7 +15,7 @@ describe "Test WinRM primitive methods" do
|
|
16
15
|
sid = @winrm.open_shell
|
17
16
|
|
18
17
|
cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
|
19
|
-
expect(sid).to
|
18
|
+
expect(sid).to be_a_uid
|
20
19
|
|
21
20
|
expect(@winrm.cleanup_command(sid, cmd_id)).to be true
|
22
21
|
@winrm.close_shell(sid)
|
@@ -27,8 +26,9 @@ describe "Test WinRM primitive methods" do
|
|
27
26
|
cmd_id = @winrm.run_command(sid, 'ipconfig', %w{/all})
|
28
27
|
|
29
28
|
output = @winrm.get_command_output(sid, cmd_id)
|
30
|
-
expect(output
|
31
|
-
expect(output
|
29
|
+
expect(output).to have_exit_code 0
|
30
|
+
expect(output).to have_stdout_match /.+/
|
31
|
+
expect(output).to have_no_stderr
|
32
32
|
|
33
33
|
@winrm.cleanup_command(sid, cmd_id)
|
34
34
|
@winrm.close_shell(sid)
|
data/spec/wql_spec.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
describe "
|
1
|
+
describe "winrm client wql", :integration => true do
|
2
2
|
before(:all) do
|
3
3
|
@winrm = winrm_connection
|
4
4
|
end
|
5
5
|
|
6
|
-
it 'should
|
7
|
-
output = @winrm.run_wql('select
|
6
|
+
it 'should query Win32_OperatingSystem' do
|
7
|
+
output = @winrm.run_wql('select * from Win32_OperatingSystem')
|
8
8
|
expect(output).to_not be_empty
|
9
|
+
output_caption = output[:win32_operating_system][0][:caption]
|
10
|
+
expect(output_caption).to include('Microsoft')
|
11
|
+
expect(output_caption).to include('Windows')
|
9
12
|
end
|
10
13
|
end
|
data/winrm.gemspec
CHANGED
@@ -24,13 +24,14 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.extra_rdoc_files = %w(README.md LICENSE)
|
25
25
|
|
26
26
|
s.required_ruby_version = '>= 1.9.0'
|
27
|
-
s.add_runtime_dependency
|
28
|
-
s.add_runtime_dependency
|
29
|
-
s.add_runtime_dependency
|
30
|
-
s.add_runtime_dependency
|
31
|
-
s.add_runtime_dependency
|
32
|
-
s.add_runtime_dependency
|
33
|
-
s.add_runtime_dependency
|
27
|
+
s.add_runtime_dependency 'gssapi', '~> 1.0'
|
28
|
+
s.add_runtime_dependency 'httpclient', '~> 2.2', '>= 2.2.0.2'
|
29
|
+
s.add_runtime_dependency 'rubyntlm', '~> 0.1'
|
30
|
+
s.add_runtime_dependency 'uuidtools', '~> 2.1.2'
|
31
|
+
s.add_runtime_dependency 'logging', '~> 1.6', '>= 1.6.1'
|
32
|
+
s.add_runtime_dependency 'nori', '~> 2.0'
|
33
|
+
s.add_runtime_dependency 'gyoku', '~> 1.0'
|
34
|
+
s.add_runtime_dependency 'builder', '>= 2.1.2'
|
34
35
|
s.add_development_dependency 'rspec', '~> 3.0.0'
|
35
36
|
s.add_development_dependency 'rake', '~> 10.3.2'
|
36
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.dev.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Wanek
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gssapi
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0
|
20
|
+
version: '1.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0
|
27
|
+
version: '1.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: httpclient
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,81 +46,95 @@ dependencies:
|
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.2.0.2
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: rubyntlm
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1
|
54
|
+
version: '0.1'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
61
|
+
version: '0.1'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: uuidtools
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.1.2
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.1.2
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: logging
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '1.6'
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.6.1
|
83
86
|
type: :runtime
|
84
87
|
prerelease: false
|
85
88
|
version_requirements: !ruby/object:Gem::Requirement
|
86
89
|
requirements:
|
87
90
|
- - ~>
|
88
91
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
92
|
+
version: '1.6'
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.6.1
|
90
96
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
97
|
+
name: nori
|
92
98
|
requirement: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- -
|
100
|
+
- - ~>
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
102
|
+
version: '2.0'
|
97
103
|
type: :runtime
|
98
104
|
prerelease: false
|
99
105
|
version_requirements: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
|
-
- -
|
107
|
+
- - ~>
|
102
108
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
109
|
+
version: '2.0'
|
104
110
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
111
|
+
name: gyoku
|
106
112
|
requirement: !ruby/object:Gem::Requirement
|
107
113
|
requirements:
|
108
114
|
- - ~>
|
109
115
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
111
|
-
- - '>='
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: 1.6.1
|
116
|
+
version: '1.0'
|
114
117
|
type: :runtime
|
115
118
|
prerelease: false
|
116
119
|
version_requirements: !ruby/object:Gem::Requirement
|
117
120
|
requirements:
|
118
121
|
- - ~>
|
119
122
|
- !ruby/object:Gem::Version
|
120
|
-
version: '1.
|
123
|
+
version: '1.0'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: builder
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
121
128
|
- - '>='
|
122
129
|
- !ruby/object:Gem::Version
|
123
|
-
version: 1.
|
130
|
+
version: 2.1.2
|
131
|
+
type: :runtime
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 2.1.2
|
124
138
|
- !ruby/object:Gem::Dependency
|
125
139
|
name: rspec
|
126
140
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,20 +182,28 @@ files:
|
|
168
182
|
- README.md
|
169
183
|
- Rakefile
|
170
184
|
- VERSION
|
185
|
+
- bin/rwinrm
|
171
186
|
- changelog.md
|
172
187
|
- lib/winrm.rb
|
173
188
|
- lib/winrm/exceptions/exceptions.rb
|
174
189
|
- lib/winrm/helpers/iso8601_duration.rb
|
190
|
+
- lib/winrm/http/response_handler.rb
|
175
191
|
- lib/winrm/http/transport.rb
|
176
192
|
- lib/winrm/soap_provider.rb
|
177
193
|
- lib/winrm/winrm_service.rb
|
178
194
|
- preamble
|
195
|
+
- spec/auth_timeout_spec.rb
|
179
196
|
- spec/cmd_spec.rb
|
180
197
|
- spec/config-example.yml
|
181
|
-
- spec/
|
198
|
+
- spec/exception_spec.rb
|
199
|
+
- spec/matchers.rb
|
182
200
|
- spec/powershell_spec.rb
|
201
|
+
- spec/response_handler_spec.rb
|
183
202
|
- spec/spec_helper.rb
|
184
|
-
- spec/
|
203
|
+
- spec/stubs/responses/open_shell_v1.xml
|
204
|
+
- spec/stubs/responses/open_shell_v2.xml
|
205
|
+
- spec/stubs/responses/soap_fault_v1.xml
|
206
|
+
- spec/stubs/responses/soap_fault_v2.xml
|
185
207
|
- spec/winrm_primitives_spec.rb
|
186
208
|
- spec/wql_spec.rb
|
187
209
|
- winrm.gemspec
|
@@ -203,9 +225,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
225
|
version: 1.9.0
|
204
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
227
|
requirements:
|
206
|
-
- - '
|
228
|
+
- - '>'
|
207
229
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
230
|
+
version: 1.3.1
|
209
231
|
requirements: []
|
210
232
|
rubyforge_project:
|
211
233
|
rubygems_version: 2.0.14
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'nori'
|
2
|
-
|
3
|
-
describe "Test Nori Type Cast Toggler", :unit => true do
|
4
|
-
before(:all) do
|
5
|
-
@winrm = winrm_connection
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should have nori advanced type casting on' do
|
9
|
-
expect(Nori.advanced_typecasting?).to be true
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should turn off nori advanced type casting' do
|
13
|
-
@winrm.toggle_nori_type_casting :off
|
14
|
-
expect(Nori.advanced_typecasting?).to be false
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should return nori advanced type casting to the original state' do
|
18
|
-
@winrm.toggle_nori_type_casting :original
|
19
|
-
expect(Nori.advanced_typecasting?).to be true
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should turn on nori advanced type casting' do
|
23
|
-
@winrm.toggle_nori_type_casting :off
|
24
|
-
@winrm.toggle_nori_type_casting :on
|
25
|
-
expect(Nori.advanced_typecasting?).to be true
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
data/spec/test.ps1
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
echo 'Getting the Environment'
|
2
|
-
echo '------------------------------------------------'
|
3
|
-
Get-ChildItem Env:
|
4
|
-
|
5
|
-
$diameter = 4.5
|
6
|
-
|
7
|
-
$area = [Math]::pow([Math]::PI * ($diameter/2), 2)
|
8
|
-
|
9
|
-
echo '------------------------------------------------'
|
10
|
-
|
11
|
-
echo 'Testing the Math library'
|
12
|
-
echo '------------------------------------------------'
|
13
|
-
|
14
|
-
echo "Circle Area: $area"
|