winrm 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f7008164689e6ff66359218a1c3d35aa83690f0
4
- data.tar.gz: 61301e63b59b0080c7e97c1a24cd9fe8feff58a2
3
+ metadata.gz: ab6bcb370baa18dbd4e1b94d90511cd56d125b0a
4
+ data.tar.gz: 6d9c7835ea837bab0450b4955955831fcdb73407
5
5
  SHA512:
6
- metadata.gz: 3947c9f5095f99380485cc7df15d9cc999ca57216882d56c8e32e8b0ae744e8fd2b2bbd4a03db012cbcf2dc66de041259d0fbdfdcbc5e4c2e9b3a60c912e8a7d
7
- data.tar.gz: a451b042529eec914cb0cfcb72d4c59b76453e49fb371b3f35ae8b0abf362d2a9b307807fc8cce582adcafd3e32dfe29b7aa7485afcf713db59db37ef8506a4b
6
+ metadata.gz: ed23571d9ad2479542694df5217dfdbe82c4697a1f3844324ba9c11c0112a96e2ea047355e2bc173c8fff68c2432b020cdf30e7e3b40241c12190f80342b1309
7
+ data.tar.gz: 2650558508f0a36ec2f20caf21d22a68fc743cb5942c731273f04f1000f9520d2bf51ddf1df410042c2f2bd83c3e0735b835a25e08510c344423d0cde5098212
@@ -1,5 +1,9 @@
1
1
  # WinRM Gem Changelog
2
2
 
3
+ # 2.1.3
4
+ - Ignore WSManFault 2150858843 during command cleanup
5
+ - Uns `Integer` in place of `Fixnum` to remove deprecation warnings in ruby 2.4
6
+
3
7
  # 2.1.2
4
8
  - Fix kerberos transport
5
9
 
@@ -75,16 +75,16 @@ module WinRM
75
75
  end
76
76
 
77
77
  def validate_data_types
78
- validate_fixnum(:retry_limit)
79
- validate_fixnum(:retry_delay)
80
- validate_fixnum(:max_envelope_size)
81
- validate_fixnum(:operation_timeout)
82
- validate_fixnum(:receive_timeout, self[:operation_timeout])
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 validate_fixnum(key, min = 0)
85
+ def validate_integer(key, min = 0)
86
86
  value = self[key]
87
- raise "#{key} must be a Fixnum" unless value && value.is_a?(Fixnum)
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
@@ -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 [Fixnum] The id of the fragmented message.
24
+ # @param object_id [Integer] The id of the fragmented message.
25
25
  # @param blob [Array] Array of fragmented bytes.
26
- # @param fragment_id [Fixnum] The id of this fragment
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)
@@ -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 [Fixnum] The PSRP MessageType. This is most commonly
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 [Fixnum] The destination for this message - client or server
76
+ # @param destination [Integer] The destination for this message - client or server
77
77
  def initialize(
78
78
  runspace_pool_id,
79
79
  type,
@@ -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 == ERROR_OPERATION_ABORTED
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 [Fixnum] The number of times to retry
35
- # @param delay [Fixnum] The number of seconds to wait between retry attempts
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
@@ -3,5 +3,5 @@
3
3
  # WinRM module
4
4
  module WinRM
5
5
  # The version of the WinRM library
6
- VERSION = '2.1.2'.freeze
6
+ VERSION = '2.1.3'.freeze
7
7
  end
@@ -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 [Fixnum] seconds The amount of seconds for this duration
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.2
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-01-12 00:00:00.000000000 Z
14
+ date: 2017-03-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gssapi