winrm 2.1.2 → 2.1.3
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/changelog.md +4 -0
- data/lib/winrm/connection_opts.rb +7 -7
- data/lib/winrm/psrp/fragment.rb +2 -2
- data/lib/winrm/psrp/message.rb +2 -2
- data/lib/winrm/shells/base.rb +2 -1
- data/lib/winrm/shells/retryable.rb +2 -2
- data/lib/winrm/version.rb +1 -1
- data/lib/winrm/wsmv/iso8601_duration.rb +1 -1
- data/tests/spec/shells/base_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab6bcb370baa18dbd4e1b94d90511cd56d125b0a
|
4
|
+
data.tar.gz: 6d9c7835ea837bab0450b4955955831fcdb73407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed23571d9ad2479542694df5217dfdbe82c4697a1f3844324ba9c11c0112a96e2ea047355e2bc173c8fff68c2432b020cdf30e7e3b40241c12190f80342b1309
|
7
|
+
data.tar.gz: 2650558508f0a36ec2f20caf21d22a68fc743cb5942c731273f04f1000f9520d2bf51ddf1df410042c2f2bd83c3e0735b835a25e08510c344423d0cde5098212
|
data/changelog.md
CHANGED
@@ -75,16 +75,16 @@ module WinRM
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def validate_data_types
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
validate_integer(:retry_limit)
|
79
|
+
validate_integer(:retry_delay)
|
80
|
+
validate_integer(:max_envelope_size)
|
81
|
+
validate_integer(:operation_timeout)
|
82
|
+
validate_integer(:receive_timeout, self[:operation_timeout])
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
85
|
+
def validate_integer(key, min = 0)
|
86
86
|
value = self[key]
|
87
|
-
raise "#{key} must be a
|
87
|
+
raise "#{key} must be a Integer" unless value && value.is_a?(Integer)
|
88
88
|
raise "#{key} must be greater than #{min}" unless value > min
|
89
89
|
end
|
90
90
|
end
|
data/lib/winrm/psrp/fragment.rb
CHANGED
@@ -21,9 +21,9 @@ module WinRM
|
|
21
21
|
# PowerShell Remoting Protocol message fragment.
|
22
22
|
class Fragment
|
23
23
|
# Creates a new PSRP message fragment
|
24
|
-
# @param object_id [
|
24
|
+
# @param object_id [Integer] The id of the fragmented message.
|
25
25
|
# @param blob [Array] Array of fragmented bytes.
|
26
|
-
# @param fragment_id [
|
26
|
+
# @param fragment_id [Integer] The id of this fragment
|
27
27
|
# @param start_fragment [Boolean] If the fragment is the first fragment
|
28
28
|
# @param end_fragment [Boolean] If the fragment is the last fragment
|
29
29
|
def initialize(object_id, blob, fragment_id = 0, start_fragment = true, end_fragment = true)
|
data/lib/winrm/psrp/message.rb
CHANGED
@@ -70,10 +70,10 @@ module WinRM
|
|
70
70
|
# Creates a new PSRP message instance
|
71
71
|
# @param runspace_pool_id [String] The UUID of the remote shell/runspace pool.
|
72
72
|
# @param pipeline_id [String] The UUID to correlate the command/pipeline response
|
73
|
-
# @param type [
|
73
|
+
# @param type [Integer] The PSRP MessageType. This is most commonly
|
74
74
|
# specified in hex, e.g. 0x00010002.
|
75
75
|
# @param data [String] The PSRP payload as serialized XML
|
76
|
-
# @param destination [
|
76
|
+
# @param destination [Integer] The destination for this message - client or server
|
77
77
|
def initialize(
|
78
78
|
runspace_pool_id,
|
79
79
|
type,
|
data/lib/winrm/shells/base.rb
CHANGED
@@ -30,6 +30,7 @@ module WinRM
|
|
30
30
|
class Base
|
31
31
|
TOO_MANY_COMMANDS = '2150859174'.freeze
|
32
32
|
ERROR_OPERATION_ABORTED = '995'.freeze
|
33
|
+
SHELL_NOT_FOUND = '2150858843'.freeze
|
33
34
|
|
34
35
|
FAULTS_FOR_RESET = [
|
35
36
|
'2150858843', # Shell has been closed
|
@@ -150,7 +151,7 @@ module WinRM
|
|
150
151
|
command_id: command_id)
|
151
152
|
transport.send_request(cleanup_msg.build)
|
152
153
|
rescue WinRMWSManFault => e
|
153
|
-
raise unless e.fault_code
|
154
|
+
raise unless [ERROR_OPERATION_ABORTED, SHELL_NOT_FOUND].include?(e.fault_code)
|
154
155
|
rescue WinRMHTTPTransportError => t
|
155
156
|
# dont let the cleanup raise so we dont lose any errors from the command
|
156
157
|
logger.info("[WinRM] #{t.status_code} returned in cleanup with error: #{t.message}")
|
@@ -31,8 +31,8 @@ module WinRM
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# Retries the operation a specified number of times with a delay between
|
34
|
-
# @param retries [
|
35
|
-
# @param delay [
|
34
|
+
# @param retries [Integer] The number of times to retry
|
35
|
+
# @param delay [Integer] The number of seconds to wait between retry attempts
|
36
36
|
def retryable(retries, delay)
|
37
37
|
yield
|
38
38
|
rescue *RETRYABLE_EXCEPTIONS.call
|
data/lib/winrm/version.rb
CHANGED
@@ -23,7 +23,7 @@ module WinRM
|
|
23
23
|
module Iso8601Duration
|
24
24
|
# Convert the number of seconds to an ISO8601 duration format
|
25
25
|
# @see http://tools.ietf.org/html/rfc2445#section-4.3.6
|
26
|
-
# @param [
|
26
|
+
# @param [Integer] seconds The amount of seconds for this duration
|
27
27
|
def self.sec_to_dur(seconds)
|
28
28
|
seconds = seconds.to_i
|
29
29
|
iso_str = 'P'
|
@@ -117,6 +117,20 @@ describe DummyShell do
|
|
117
117
|
subject.run(command, arguments)
|
118
118
|
end
|
119
119
|
|
120
|
+
it 'does not error if shell is not present anymore' do
|
121
|
+
allow(SecureRandom).to receive(:uuid).and_return('uuid')
|
122
|
+
expect(transport).to receive(:send_request)
|
123
|
+
.with(
|
124
|
+
WinRM::WSMV::CleanupCommand.new(
|
125
|
+
connection_options,
|
126
|
+
shell_uri: nil,
|
127
|
+
shell_id: shell_id,
|
128
|
+
command_id: command_id
|
129
|
+
).build
|
130
|
+
).and_raise(WinRM::WinRMWSManFault.new('oops', '2150858843'))
|
131
|
+
subject.run(command, arguments)
|
132
|
+
end
|
133
|
+
|
120
134
|
it 'opens a shell only once when shell is already open' do
|
121
135
|
expect(subject).to receive(:open_shell).and_call_original.once
|
122
136
|
subject.run(command, arguments)
|
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: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Wanek
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: gssapi
|