winrm 1.7.0 → 1.7.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/.gitignore +10 -10
- data/.rspec +3 -3
- data/.rubocop.yml +12 -12
- data/.travis.yml +12 -12
- data/Gemfile +9 -9
- data/LICENSE +202 -202
- data/README.md +194 -194
- data/Rakefile +36 -36
- data/Vagrantfile +9 -9
- data/appveyor.yml +42 -42
- data/bin/rwinrm +97 -97
- data/changelog.md +74 -71
- data/lib/winrm.rb +42 -42
- data/lib/winrm/command_executor.rb +224 -224
- data/lib/winrm/exceptions/exceptions.rb +57 -57
- data/lib/winrm/helpers/iso8601_duration.rb +58 -58
- data/lib/winrm/helpers/powershell_script.rb +42 -42
- data/lib/winrm/http/response_handler.rb +82 -82
- data/lib/winrm/http/transport.rb +421 -421
- data/lib/winrm/output.rb +43 -43
- data/lib/winrm/soap_provider.rb +39 -39
- data/lib/winrm/version.rb +7 -7
- data/lib/winrm/winrm_service.rb +556 -556
- data/preamble +17 -17
- data/spec/auth_timeout_spec.rb +16 -16
- data/spec/cmd_spec.rb +102 -102
- data/spec/command_executor_spec.rb +429 -429
- data/spec/config-example.yml +19 -19
- data/spec/exception_spec.rb +50 -50
- data/spec/issue_184_spec.rb +67 -67
- data/spec/issue_59_spec.rb +23 -23
- data/spec/matchers.rb +74 -74
- data/spec/output_spec.rb +110 -110
- data/spec/powershell_spec.rb +97 -97
- data/spec/response_handler_spec.rb +59 -59
- data/spec/spec_helper.rb +73 -73
- data/spec/stubs/responses/get_command_output_response.xml.erb +13 -13
- data/spec/stubs/responses/open_shell_v1.xml +19 -19
- data/spec/stubs/responses/open_shell_v2.xml +20 -20
- data/spec/stubs/responses/soap_fault_v1.xml +36 -36
- data/spec/stubs/responses/soap_fault_v2.xml +42 -42
- data/spec/stubs/responses/wmi_error_v2.xml +41 -41
- data/spec/transport_spec.rb +124 -124
- data/spec/winrm_options_spec.rb +76 -76
- data/spec/winrm_primitives_spec.rb +51 -51
- data/spec/wql_spec.rb +14 -14
- data/winrm.gemspec +40 -40
- metadata +2 -2
data/Vagrantfile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# -*- mode: ruby -*-
|
3
|
-
# vi: set ft=ruby :
|
4
|
-
|
5
|
-
VAGRANTFILE_API_VERSION = '2'
|
6
|
-
|
7
|
-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
-
config.vm.box = 'mwrock/Windows2012R2'
|
9
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
# -*- mode: ruby -*-
|
3
|
+
# vi: set ft=ruby :
|
4
|
+
|
5
|
+
VAGRANTFILE_API_VERSION = '2'
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
config.vm.box = 'mwrock/Windows2012R2'
|
9
|
+
end
|
data/appveyor.yml
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
version: "master-{build}"
|
2
|
-
|
3
|
-
os: Windows Server 2012 R2
|
4
|
-
platform:
|
5
|
-
- x64
|
6
|
-
|
7
|
-
environment:
|
8
|
-
winrm_user: test_user
|
9
|
-
winrm_pass: Pass@word1
|
10
|
-
|
11
|
-
matrix:
|
12
|
-
- ruby_version: "21"
|
13
|
-
winrm_endpoint: http://localhost:5985/wsman
|
14
|
-
|
15
|
-
clone_folder: c:\projects\winrm
|
16
|
-
clone_depth: 1
|
17
|
-
branches:
|
18
|
-
only:
|
19
|
-
- master
|
20
|
-
|
21
|
-
install:
|
22
|
-
- ps: net user /add $env:winrm_user $env:winrm_pass
|
23
|
-
- ps: net localgroup administrators $env:winrm_user /add
|
24
|
-
- ps: $env:winrm_cert = (New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:\localmachine\my).Thumbprint
|
25
|
-
- ps: winrm create winrm/config/Listener?Address=*+Transport=HTTPS "@{Hostname=`"localhost`";CertificateThumbprint=`"$($env:winrm_cert)`"}"
|
26
|
-
- ps: winrm set winrm/config/client/auth '@{Basic="true"}'
|
27
|
-
- ps: winrm set winrm/config/service/auth '@{Basic="true"}'
|
28
|
-
- ps: winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'
|
29
|
-
- ps: winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
30
|
-
- ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
|
31
|
-
- ps: Write-Host $env:PATH
|
32
|
-
- ps: ruby --version
|
33
|
-
- ps: gem --version
|
34
|
-
- ps: gem install bundler --quiet --no-ri --no-rdoc
|
35
|
-
- ps: bundler --version
|
36
|
-
|
37
|
-
build_script:
|
38
|
-
- bundle install || bundle install || bundle install
|
39
|
-
|
40
|
-
test_script:
|
41
|
-
- SET SPEC_OPTS=--format progress
|
42
|
-
- bundle exec rake integration
|
1
|
+
version: "master-{build}"
|
2
|
+
|
3
|
+
os: Windows Server 2012 R2
|
4
|
+
platform:
|
5
|
+
- x64
|
6
|
+
|
7
|
+
environment:
|
8
|
+
winrm_user: test_user
|
9
|
+
winrm_pass: Pass@word1
|
10
|
+
|
11
|
+
matrix:
|
12
|
+
- ruby_version: "21"
|
13
|
+
winrm_endpoint: http://localhost:5985/wsman
|
14
|
+
|
15
|
+
clone_folder: c:\projects\winrm
|
16
|
+
clone_depth: 1
|
17
|
+
branches:
|
18
|
+
only:
|
19
|
+
- master
|
20
|
+
|
21
|
+
install:
|
22
|
+
- ps: net user /add $env:winrm_user $env:winrm_pass
|
23
|
+
- ps: net localgroup administrators $env:winrm_user /add
|
24
|
+
- ps: $env:winrm_cert = (New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:\localmachine\my).Thumbprint
|
25
|
+
- ps: winrm create winrm/config/Listener?Address=*+Transport=HTTPS "@{Hostname=`"localhost`";CertificateThumbprint=`"$($env:winrm_cert)`"}"
|
26
|
+
- ps: winrm set winrm/config/client/auth '@{Basic="true"}'
|
27
|
+
- ps: winrm set winrm/config/service/auth '@{Basic="true"}'
|
28
|
+
- ps: winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'
|
29
|
+
- ps: winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
30
|
+
- ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
|
31
|
+
- ps: Write-Host $env:PATH
|
32
|
+
- ps: ruby --version
|
33
|
+
- ps: gem --version
|
34
|
+
- ps: gem install bundler --quiet --no-ri --no-rdoc
|
35
|
+
- ps: bundler --version
|
36
|
+
|
37
|
+
build_script:
|
38
|
+
- bundle install || bundle install || bundle install
|
39
|
+
|
40
|
+
test_script:
|
41
|
+
- SET SPEC_OPTS=--format progress
|
42
|
+
- bundle exec rake integration
|
data/bin/rwinrm
CHANGED
@@ -1,97 +1,97 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
# Copyright 2014 Shawn Neal <sneal@sneal.net>
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
|
18
|
-
# rubocop:disable all
|
19
|
-
|
20
|
-
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
21
|
-
|
22
|
-
require 'readline'
|
23
|
-
require 'io/console'
|
24
|
-
require 'winrm'
|
25
|
-
|
26
|
-
def help_msg
|
27
|
-
puts 'Usage: rwinrm user@host'
|
28
|
-
puts ''
|
29
|
-
end
|
30
|
-
|
31
|
-
def parse_options
|
32
|
-
options = {}
|
33
|
-
fail 'Missing required options' unless ARGV.length == 1
|
34
|
-
|
35
|
-
m = /^(?<user>[a-z0-9\.\!\$ _-]+)@{1}(?<host>[a-z0-9\.\-]+)(?<port>:[0-9]+)?/i.match(ARGV[0])
|
36
|
-
fail "#{ARGV[0]} is an invalid host" unless m
|
37
|
-
options[:user] = m[:user]
|
38
|
-
options[:endpoint] = "http://#{m[:host]}#{m[:port] || ':5985'}/wsman"
|
39
|
-
|
40
|
-
# Get the password
|
41
|
-
print 'Password: '
|
42
|
-
options[:pass] = STDIN.noecho(&:gets).chomp
|
43
|
-
puts
|
44
|
-
|
45
|
-
# Set some defaults required by WinRM WS
|
46
|
-
options[:auth_type] = :plaintext
|
47
|
-
options[:basic_auth_only] = true
|
48
|
-
|
49
|
-
options
|
50
|
-
rescue StandardError => e
|
51
|
-
puts e.message
|
52
|
-
help_msg
|
53
|
-
exit 1
|
54
|
-
end
|
55
|
-
|
56
|
-
def repl(options)
|
57
|
-
client = WinRM::WinRMWebService.new(
|
58
|
-
options[:endpoint],
|
59
|
-
options[:auth_type].to_sym,
|
60
|
-
options)
|
61
|
-
|
62
|
-
client.set_timeout(3600)
|
63
|
-
shell_id = client.open_shell
|
64
|
-
command_id = client.run_command(shell_id, 'cmd', "/K prompt [#{ARGV[0]}]$P$G")
|
65
|
-
|
66
|
-
read_thread = Thread.new do
|
67
|
-
client.get_command_output(shell_id, command_id) do |stdout, stderr|
|
68
|
-
STDOUT.write stdout
|
69
|
-
STDERR.write stderr
|
70
|
-
end
|
71
|
-
end
|
72
|
-
read_thread.abort_on_exception = true
|
73
|
-
|
74
|
-
while (buf = Readline.readline('', true))
|
75
|
-
if buf =~ /^exit/
|
76
|
-
read_thread.exit
|
77
|
-
client.cleanup_command(shell_id, command_id)
|
78
|
-
client.close_shell(shell_id)
|
79
|
-
exit 0
|
80
|
-
else
|
81
|
-
client.write_stdin(shell_id, command_id, "#{buf}\r\n")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
rescue Interrupt
|
85
|
-
puts 'exiting'
|
86
|
-
# ctrl-c
|
87
|
-
rescue WinRM::WinRMAuthorizationError
|
88
|
-
puts 'Authentication failed, bad user name or password'
|
89
|
-
exit 1
|
90
|
-
rescue StandardError => e
|
91
|
-
puts e.message
|
92
|
-
exit 1
|
93
|
-
end
|
94
|
-
|
95
|
-
repl(parse_options)
|
96
|
-
|
97
|
-
# rubocop:enable all
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# Copyright 2014 Shawn Neal <sneal@sneal.net>
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
# rubocop:disable all
|
19
|
+
|
20
|
+
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
21
|
+
|
22
|
+
require 'readline'
|
23
|
+
require 'io/console'
|
24
|
+
require 'winrm'
|
25
|
+
|
26
|
+
def help_msg
|
27
|
+
puts 'Usage: rwinrm user@host'
|
28
|
+
puts ''
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_options
|
32
|
+
options = {}
|
33
|
+
fail 'Missing required options' unless ARGV.length == 1
|
34
|
+
|
35
|
+
m = /^(?<user>[a-z0-9\.\!\$ _-]+)@{1}(?<host>[a-z0-9\.\-]+)(?<port>:[0-9]+)?/i.match(ARGV[0])
|
36
|
+
fail "#{ARGV[0]} is an invalid host" unless m
|
37
|
+
options[:user] = m[:user]
|
38
|
+
options[:endpoint] = "http://#{m[:host]}#{m[:port] || ':5985'}/wsman"
|
39
|
+
|
40
|
+
# Get the password
|
41
|
+
print 'Password: '
|
42
|
+
options[:pass] = STDIN.noecho(&:gets).chomp
|
43
|
+
puts
|
44
|
+
|
45
|
+
# Set some defaults required by WinRM WS
|
46
|
+
options[:auth_type] = :plaintext
|
47
|
+
options[:basic_auth_only] = true
|
48
|
+
|
49
|
+
options
|
50
|
+
rescue StandardError => e
|
51
|
+
puts e.message
|
52
|
+
help_msg
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
|
56
|
+
def repl(options)
|
57
|
+
client = WinRM::WinRMWebService.new(
|
58
|
+
options[:endpoint],
|
59
|
+
options[:auth_type].to_sym,
|
60
|
+
options)
|
61
|
+
|
62
|
+
client.set_timeout(3600)
|
63
|
+
shell_id = client.open_shell
|
64
|
+
command_id = client.run_command(shell_id, 'cmd', "/K prompt [#{ARGV[0]}]$P$G")
|
65
|
+
|
66
|
+
read_thread = Thread.new do
|
67
|
+
client.get_command_output(shell_id, command_id) do |stdout, stderr|
|
68
|
+
STDOUT.write stdout
|
69
|
+
STDERR.write stderr
|
70
|
+
end
|
71
|
+
end
|
72
|
+
read_thread.abort_on_exception = true
|
73
|
+
|
74
|
+
while (buf = Readline.readline('', true))
|
75
|
+
if buf =~ /^exit/
|
76
|
+
read_thread.exit
|
77
|
+
client.cleanup_command(shell_id, command_id)
|
78
|
+
client.close_shell(shell_id)
|
79
|
+
exit 0
|
80
|
+
else
|
81
|
+
client.write_stdin(shell_id, command_id, "#{buf}\r\n")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
rescue Interrupt
|
85
|
+
puts 'exiting'
|
86
|
+
# ctrl-c
|
87
|
+
rescue WinRM::WinRMAuthorizationError
|
88
|
+
puts 'Authentication failed, bad user name or password'
|
89
|
+
exit 1
|
90
|
+
rescue StandardError => e
|
91
|
+
puts e.message
|
92
|
+
exit 1
|
93
|
+
end
|
94
|
+
|
95
|
+
repl(parse_options)
|
96
|
+
|
97
|
+
# rubocop:enable all
|
data/changelog.md
CHANGED
@@ -1,71 +1,74 @@
|
|
1
|
-
# WinRM Gem Changelog
|
2
|
-
|
3
|
-
# 1.7.
|
4
|
-
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
-
|
9
|
-
|
10
|
-
# 1.6.
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
|
19
|
-
|
20
|
-
-
|
21
|
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
# 1.
|
26
|
-
-
|
27
|
-
|
28
|
-
# 1.3.
|
29
|
-
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
-
|
34
|
-
|
35
|
-
# 1.3.
|
36
|
-
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
- Fixed
|
50
|
-
|
51
|
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
|
67
|
-
|
68
|
-
-
|
69
|
-
|
70
|
-
|
71
|
-
-
|
1
|
+
# WinRM Gem Changelog
|
2
|
+
|
3
|
+
# 1.7.1
|
4
|
+
- Fix OS version comparisons for Windows 10 using `Gem::Version` instead of strings
|
5
|
+
|
6
|
+
# 1.7.0
|
7
|
+
- Bump rubyntlm gem to 0.6.0 to get channel binding support for HTTPS fixing connections to endoints with `CbtHardeningLevel` set to `Strict`
|
8
|
+
- Fix for parsing binary data in command output
|
9
|
+
|
10
|
+
# 1.6.1
|
11
|
+
- Use codepage 437 by default on os versions older than Windows 7 and Windows Server 2008 R2
|
12
|
+
|
13
|
+
# 1.6.0
|
14
|
+
- Adding `:negotiate` transport providing NTLM/Negotiate encryption of WinRM requests and responses
|
15
|
+
- Removed dependency on UUIDTools gem
|
16
|
+
- Extending accepted error codes for retry behavior to include `Errno::ETIMEDOUT`
|
17
|
+
- Correct deprecation warning for WinRMWebService.run_powershell_script
|
18
|
+
|
19
|
+
# 1.5.0
|
20
|
+
- Deprecating `WinRM::WinRMWebService` methods `cmd`, `run_cmd`, `powershell`, and `run_powershell_script` in favor of the `run_cmd` and `run_powershell_script` methods of the `WinRM::CommandExecutor` class. The `CommandExecutor` allows multiple commands to be run from the same WinRM shell providing a significant performance improvement when issuing multiple calls.
|
21
|
+
- Added an `:ssl_peer_fingerprint` option to be used instead of `:no_ssl_peer_verification` and allows a specific certificate to be verified.
|
22
|
+
- Opening a winrm shell is retriable with configurable delay and retry limit.
|
23
|
+
- Logging apends to `stdout` by default and can be replaced with a logger from a consuming application.
|
24
|
+
|
25
|
+
# 1.4.0
|
26
|
+
- Added WinRM::Version so the gem version is available at runtime for consumers.
|
27
|
+
|
28
|
+
# 1.3.6
|
29
|
+
- Remove BOM from response (Issue #159) added by Windows 2008R2
|
30
|
+
|
31
|
+
# 1.3.5
|
32
|
+
- Widen logging version constraints to include 2.0
|
33
|
+
- Use codepage 65001 (UTF-8)
|
34
|
+
|
35
|
+
# 1.3.4
|
36
|
+
- Relaxed version pins on dev dependencies
|
37
|
+
|
38
|
+
# 1.3.3
|
39
|
+
- Fixed issue 133, rwinrm allow hostnames with dashes
|
40
|
+
- Use duck typing for powershell script read
|
41
|
+
|
42
|
+
# 1.3.2
|
43
|
+
- Add spec.license attribute to gemspec
|
44
|
+
- Bump RSpec dependency 3.0 to 3.2
|
45
|
+
|
46
|
+
# 1.3.1
|
47
|
+
- Fixed issue 129, long running commands could cause a stackoverflow exception
|
48
|
+
- Fixed use of sub! in run_command results in spurious capture/replacement of \& sequences
|
49
|
+
- Fixed issue 124 rwinrm won't take '.' characters in username
|
50
|
+
|
51
|
+
# 1.3.0
|
52
|
+
- Fixed multiple issues with WinRMHTTPTransportError incorrectly being raised
|
53
|
+
- Refactored and added more unit and integration tests
|
54
|
+
- Added ability to write to stdin
|
55
|
+
- Added rwinrm binary to launch remote shell
|
56
|
+
- Added WINRM_LOG env var to set log level
|
57
|
+
- Retry Kerberos auth once if 401 response is received
|
58
|
+
- Remove Savon dependency and use newer versions of underlying dependencies
|
59
|
+
- Remove Nokogiri dependency and replace with native Ruby XML
|
60
|
+
- Fixed issue 85, ensure WQL response is not nil
|
61
|
+
- All WinRM library errors inherit from base class WinRMError
|
62
|
+
- Integrations tests should now pass on Windows Server 2008+
|
63
|
+
- Bump Ruby NTLM gem version dependency
|
64
|
+
- HTTP client receive timeout is now configurable via set_timeout
|
65
|
+
- Added backwards compatible Output class to make it easier to collect output
|
66
|
+
- Bumped gssapi dependency from 1.0 to 1.2 and fixed issue 54
|
67
|
+
- Added Rubocop to build
|
68
|
+
- Fixed error when commands contain a newline character
|
69
|
+
|
70
|
+
# 1.2.0
|
71
|
+
- Allow user to disable SSL peer ceritifcate validation #44
|
72
|
+
- Allow commands with "'" chars on Ruby 2.x, fixes #69
|
73
|
+
- Fixed uninitialized constant Module::Kconv in Ruby 2.x, fixes #65
|
74
|
+
- Commands with non-ASCII chars should work, #70
|
data/lib/winrm.rb
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'date'
|
18
|
-
require 'logging'
|
19
|
-
require_relative 'winrm/version'
|
20
|
-
|
21
|
-
# Main WinRM module entry point
|
22
|
-
module WinRM
|
23
|
-
# Enable logging if it is requested. We do this before
|
24
|
-
# anything else so that we can setup the output before
|
25
|
-
# any logging occurs.
|
26
|
-
if ENV['WINRM_LOG'] && ENV['WINRM_LOG'] != ''
|
27
|
-
begin
|
28
|
-
Logging.logger.root.level = ENV['WINRM_LOG']
|
29
|
-
Logging.logger.root.appenders = Logging.appenders.stderr
|
30
|
-
rescue ArgumentError
|
31
|
-
# This means that the logging level wasn't valid
|
32
|
-
$stderr.puts "Invalid WINRM_LOG level is set: #{ENV['WINRM_LOG']}"
|
33
|
-
$stderr.puts ''
|
34
|
-
$stderr.puts 'Please use one of the standard log levels: ' \
|
35
|
-
'debug, info, warn, or error'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
require 'winrm/output'
|
41
|
-
require 'winrm/helpers/iso8601_duration'
|
42
|
-
require 'winrm/soap_provider'
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright 2010 Dan Wanek <dan.wanek@gmail.com>
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
require 'logging'
|
19
|
+
require_relative 'winrm/version'
|
20
|
+
|
21
|
+
# Main WinRM module entry point
|
22
|
+
module WinRM
|
23
|
+
# Enable logging if it is requested. We do this before
|
24
|
+
# anything else so that we can setup the output before
|
25
|
+
# any logging occurs.
|
26
|
+
if ENV['WINRM_LOG'] && ENV['WINRM_LOG'] != ''
|
27
|
+
begin
|
28
|
+
Logging.logger.root.level = ENV['WINRM_LOG']
|
29
|
+
Logging.logger.root.appenders = Logging.appenders.stderr
|
30
|
+
rescue ArgumentError
|
31
|
+
# This means that the logging level wasn't valid
|
32
|
+
$stderr.puts "Invalid WINRM_LOG level is set: #{ENV['WINRM_LOG']}"
|
33
|
+
$stderr.puts ''
|
34
|
+
$stderr.puts 'Please use one of the standard log levels: ' \
|
35
|
+
'debug, info, warn, or error'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
require 'winrm/output'
|
41
|
+
require 'winrm/helpers/iso8601_duration'
|
42
|
+
require 'winrm/soap_provider'
|