winrm 1.3.0.dev.3 → 1.3.0
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/.rubocop.yml +9 -0
- data/Gemfile +1 -0
- data/README.md +8 -27
- data/Rakefile +12 -10
- data/VERSION +1 -1
- data/Vagrantfile +3 -2
- data/bin/rwinrm +21 -15
- data/changelog.md +22 -1
- data/lib/winrm.rb +12 -9
- data/lib/winrm/exceptions/exceptions.rb +5 -10
- data/lib/winrm/helpers/iso8601_duration.rb +22 -15
- data/lib/winrm/helpers/powershell_script.rb +18 -3
- data/lib/winrm/http/response_handler.rb +32 -32
- data/lib/winrm/http/transport.rb +65 -37
- data/lib/winrm/output.rb +16 -0
- data/lib/winrm/soap_provider.rb +17 -14
- data/lib/winrm/winrm_service.rb +14 -6
- data/spec/auth_timeout_spec.rb +2 -1
- data/spec/cmd_spec.rb +12 -11
- data/spec/exception_spec.rb +6 -8
- data/spec/issue_59_spec.rb +15 -0
- data/spec/matchers.rb +5 -3
- data/spec/output_spec.rb +57 -53
- data/spec/powershell_spec.rb +16 -14
- data/spec/response_handler_spec.rb +12 -11
- data/spec/spec_helper.rb +10 -7
- data/spec/winrm_options_spec.rb +6 -5
- data/spec/winrm_primitives_spec.rb +9 -10
- data/spec/wql_spec.rb +2 -1
- data/winrm.gemspec +16 -15
- metadata +20 -4
data/spec/spec_helper.rb
CHANGED
@@ -1,30 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'rubygems'
|
2
3
|
require 'bundler/setup'
|
3
4
|
require 'winrm'
|
4
5
|
require 'json'
|
5
6
|
require_relative 'matchers'
|
6
7
|
|
8
|
+
# Creates a WinRM connection for integration tests
|
7
9
|
module ConnectionHelper
|
8
|
-
|
9
10
|
def winrm_connection
|
10
11
|
config = symbolize_keys(YAML.load(File.read(winrm_config_path)))
|
11
|
-
config[:options].merge!(
|
12
|
-
winrm = WinRM::WinRMWebService.new(
|
12
|
+
config[:options].merge!(basic_auth_only: true) unless config[:auth_type].eql? :kerberos
|
13
|
+
winrm = WinRM::WinRMWebService.new(
|
14
|
+
config[:endpoint], config[:auth_type].to_sym, config[:options])
|
13
15
|
winrm
|
14
16
|
end
|
15
17
|
|
16
18
|
def winrm_config_path
|
17
19
|
# Copy config-example.yml to config.yml and edit for your local configuration
|
18
20
|
path = File.expand_path("#{File.dirname(__FILE__)}/config.yml")
|
19
|
-
|
21
|
+
unless File.exist?(path)
|
20
22
|
# user hasn't done this, so use sane defaults for unit tests
|
21
23
|
path = File.expand_path("#{File.dirname(__FILE__)}/config-example.yml")
|
22
24
|
end
|
23
25
|
path
|
24
26
|
end
|
25
27
|
|
28
|
+
# rubocop:disable Metrics/MethodLength
|
26
29
|
def symbolize_keys(hash)
|
27
|
-
hash.
|
30
|
+
hash.each_with_object({}) do |(key, value), result|
|
28
31
|
new_key = case key
|
29
32
|
when String then key.to_sym
|
30
33
|
else key
|
@@ -35,9 +38,9 @@ module ConnectionHelper
|
|
35
38
|
end
|
36
39
|
result[new_key] = new_value
|
37
40
|
result
|
38
|
-
|
41
|
+
end
|
39
42
|
end
|
40
|
-
|
43
|
+
# rubocop:enable Metrics/MethodLength
|
41
44
|
end
|
42
45
|
|
43
46
|
RSpec.configure do |config|
|
data/spec/winrm_options_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
describe 'WinRM options', unit: true do
|
2
3
|
let(:subject) { WinRM::WinRMWebService.new('http://localhost:55985/wsman', :plaintext) }
|
3
4
|
|
4
5
|
context 'when operations timeout is set to 60' do
|
@@ -32,10 +33,10 @@ describe 'WinRM options', :unit => true do
|
|
32
33
|
end
|
33
34
|
|
34
35
|
context 'when max_env_size is set to 614400' do
|
35
|
-
before(:each) { subject.max_env_size(
|
36
|
+
before(:each) { subject.max_env_size(614_400) }
|
36
37
|
describe '@max_env_sz' do
|
37
38
|
it 'is set to 614400' do
|
38
|
-
expect(subject.instance_variable_get('@max_env_sz')).to eq(
|
39
|
+
expect(subject.instance_variable_get('@max_env_sz')).to eq(614_400)
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -68,8 +69,8 @@ describe 'WinRM options', :unit => true do
|
|
68
69
|
end
|
69
70
|
describe '@max_env_sz' do
|
70
71
|
it 'should be 153600' do
|
71
|
-
expect(subject.instance_variable_get('@max_env_sz')).to eq(
|
72
|
+
expect(subject.instance_variable_get('@max_env_sz')).to eq(153_600)
|
72
73
|
end
|
73
74
|
end
|
74
|
-
end
|
75
|
+
end
|
75
76
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
describe 'winrm client primitives' do
|
2
3
|
before(:all) do
|
3
4
|
@winrm = winrm_connection
|
4
5
|
end
|
5
6
|
|
6
|
-
describe
|
7
|
-
|
7
|
+
describe 'open and close shell', integration: true do
|
8
8
|
it 'should #open_shell and #close_shell' do
|
9
9
|
sid = @winrm.open_shell
|
10
10
|
expect(sid).to be_a_uid
|
@@ -14,7 +14,7 @@ describe "winrm client primitives" do
|
|
14
14
|
it 'should #run_command and #cleanup_command' do
|
15
15
|
sid = @winrm.open_shell
|
16
16
|
|
17
|
-
cmd_id = @winrm.run_command(sid, 'ipconfig', %w
|
17
|
+
cmd_id = @winrm.run_command(sid, 'ipconfig', %w(/all))
|
18
18
|
expect(sid).to be_a_uid
|
19
19
|
|
20
20
|
expect(@winrm.cleanup_command(sid, cmd_id)).to be true
|
@@ -23,23 +23,23 @@ describe "winrm client primitives" do
|
|
23
23
|
|
24
24
|
it 'should #get_command_output' do
|
25
25
|
sid = @winrm.open_shell
|
26
|
-
cmd_id = @winrm.run_command(sid, 'ipconfig', %w
|
26
|
+
cmd_id = @winrm.run_command(sid, 'ipconfig', %w(/all))
|
27
27
|
|
28
28
|
output = @winrm.get_command_output(sid, cmd_id)
|
29
29
|
expect(output).to have_exit_code 0
|
30
|
-
expect(output).to have_stdout_match
|
30
|
+
expect(output).to have_stdout_match(/.+/)
|
31
31
|
expect(output).to have_no_stderr
|
32
32
|
|
33
33
|
@winrm.cleanup_command(sid, cmd_id)
|
34
34
|
@winrm.close_shell(sid)
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
it 'should #get_command_output with a block' do
|
38
38
|
sid = @winrm.open_shell
|
39
|
-
cmd_id = @winrm.run_command(sid, 'ipconfig', %w
|
39
|
+
cmd_id = @winrm.run_command(sid, 'ipconfig', %w(/all))
|
40
40
|
|
41
41
|
outvar = ''
|
42
|
-
@winrm.get_command_output(sid, cmd_id) do |stdout,
|
42
|
+
@winrm.get_command_output(sid, cmd_id) do |stdout, _stderr|
|
43
43
|
outvar << stdout
|
44
44
|
end
|
45
45
|
expect(outvar).to match(/Windows IP Configuration/)
|
@@ -48,5 +48,4 @@ describe "winrm client primitives" do
|
|
48
48
|
@winrm.close_shell(sid)
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
52
51
|
end
|
data/spec/wql_spec.rb
CHANGED
data/winrm.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
require 'date'
|
3
3
|
|
4
|
-
version = File.read(File.expand_path(
|
4
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.platform = Gem::Platform::RUBY
|
@@ -9,9 +9,9 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.version = version
|
10
10
|
s.date = Date.today.to_s
|
11
11
|
|
12
|
-
s.author = ['Dan Wanek','Paul Morton']
|
13
|
-
s.email = ['dan.wanek@gmail.com','paul@themortonsonline.com']
|
14
|
-
s.homepage =
|
12
|
+
s.author = ['Dan Wanek', 'Paul Morton']
|
13
|
+
s.email = ['dan.wanek@gmail.com', 'paul@themortonsonline.com']
|
14
|
+
s.homepage = 'http://github.com/WinRb/WinRM'
|
15
15
|
|
16
16
|
s.summary = 'Ruby library for Windows Remote Management'
|
17
17
|
s.description = <<-EOF
|
@@ -19,21 +19,22 @@ Gem::Specification.new do |s|
|
|
19
19
|
EOF
|
20
20
|
|
21
21
|
s.files = `git ls-files`.split(/\n/)
|
22
|
-
s.require_path =
|
22
|
+
s.require_path = 'lib'
|
23
23
|
s.rdoc_options = %w(-x test/ -x examples/)
|
24
24
|
s.extra_rdoc_files = %w(README.md LICENSE)
|
25
25
|
|
26
|
-
s.bindir =
|
26
|
+
s.bindir = 'bin'
|
27
27
|
s.executables = ['rwinrm']
|
28
28
|
s.required_ruby_version = '>= 1.9.0'
|
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
|
34
|
-
s.add_runtime_dependency
|
35
|
-
s.add_runtime_dependency
|
36
|
-
s.add_runtime_dependency
|
29
|
+
s.add_runtime_dependency 'gssapi', '~> 1.2'
|
30
|
+
s.add_runtime_dependency 'httpclient', '~> 2.2', '>= 2.2.0.2'
|
31
|
+
s.add_runtime_dependency 'rubyntlm', '~> 0.4.0'
|
32
|
+
s.add_runtime_dependency 'uuidtools', '~> 2.1.2'
|
33
|
+
s.add_runtime_dependency 'logging', '~> 1.6', '>= 1.6.1'
|
34
|
+
s.add_runtime_dependency 'nori', '~> 2.0'
|
35
|
+
s.add_runtime_dependency 'gyoku', '~> 1.0'
|
36
|
+
s.add_runtime_dependency 'builder', '>= 2.1.2'
|
37
37
|
s.add_development_dependency 'rspec', '~> 3.0.0'
|
38
38
|
s.add_development_dependency 'rake', '~> 10.3.2'
|
39
|
+
s.add_development_dependency 'rubocop', '~> 0.28.0'
|
39
40
|
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.3.0
|
4
|
+
version: 1.3.0
|
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: 2015-01-
|
12
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gssapi
|
@@ -163,6 +163,20 @@ dependencies:
|
|
163
163
|
- - ~>
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: 10.3.2
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: rubocop
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ~>
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 0.28.0
|
173
|
+
type: :development
|
174
|
+
prerelease: false
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ~>
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 0.28.0
|
166
180
|
description: |2
|
167
181
|
Ruby library for Windows Remote Management
|
168
182
|
email:
|
@@ -177,6 +191,7 @@ extra_rdoc_files:
|
|
177
191
|
files:
|
178
192
|
- .gitignore
|
179
193
|
- .rspec
|
194
|
+
- .rubocop.yml
|
180
195
|
- .travis.yml
|
181
196
|
- Gemfile
|
182
197
|
- LICENSE
|
@@ -200,6 +215,7 @@ files:
|
|
200
215
|
- spec/cmd_spec.rb
|
201
216
|
- spec/config-example.yml
|
202
217
|
- spec/exception_spec.rb
|
218
|
+
- spec/issue_59_spec.rb
|
203
219
|
- spec/matchers.rb
|
204
220
|
- spec/output_spec.rb
|
205
221
|
- spec/powershell_spec.rb
|
@@ -232,9 +248,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
232
248
|
version: 1.9.0
|
233
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
250
|
requirements:
|
235
|
-
- - '
|
251
|
+
- - '>='
|
236
252
|
- !ruby/object:Gem::Version
|
237
|
-
version:
|
253
|
+
version: '0'
|
238
254
|
requirements: []
|
239
255
|
rubyforge_project:
|
240
256
|
rubygems_version: 2.0.14
|