chef-powershell 2.18.5 → 2.18.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36453d0835276a228072f5d76630d75a6d3ecc12a5902b0a973427cc12790fe4
4
- data.tar.gz: 19c1a4cb862cda9518f107714dcf6b8f90198339ffb30450391d1aaaa977bcf5
3
+ metadata.gz: f019aa6ec88c30ebe38c6a43aa2200421ba37f6d0b8205cbd58ddccec496f8e8
4
+ data.tar.gz: 313478b0ad0850b795de5cf0a54db8a970341b5f8fa06ca39c030cf9135dc82f
5
5
  SHA512:
6
- metadata.gz: 342c398f8a5ec0259b6c4552708067cf3ecaa38c4f5fbdd0224ca0aa7ac0956b9e9c5740d854e39d7218173cd04d5202f3fc590fc64a2a2a9bf9adf3ad133419
7
- data.tar.gz: 5c8ca7ceab568a1f95a2233be781ea7367629fd1ac0c98a257bbe18f664e7e3c2eb044a0d3da5078800b1f2a37afa5a24f3f62146ff12a2316af750a26655dc7
6
+ metadata.gz: 3e5be4e69ae8804a3eebabbcbf0dd1b39079e28b17d42f6085d67f6832ac0cc52285753fa87109688dd96b79bc4410b3f8b2e2e836b1659aae73a62c3d997b3c
7
+ data.tar.gz: 5b6952643227ac0dfa25b5818288e5dfed465e871e842d618a46636dd2702153531715fe80f86c0cbebc0d22ba2cd0dc583a537b205f8d2a845e7d91f5a59f8e
@@ -80,21 +80,25 @@ class ChefPowerShell
80
80
  # try parsing the result *first* before returning from the function, and if it fails,
81
81
  # return false so that the function can be retried from the C++ side.
82
82
  begin
83
- # @@result_string = data.get_bytes(0, size).force_encoding("UTF-16LE").encode("UTF-8")
84
- @result_string = data.get_bytes(0, size).force_encoding("UTF-16LE").encode("UTF-8").bytes.reverse.drop_while {|x| x == 0}.reverse.pack("C*")
83
+ @result_string = data.get_bytes(0, size).force_encoding("UTF-16LE").encode("UTF-8")
85
84
  @hashed_outcome = FFI_Yajl::Parser.parse(@result_string)
86
85
  @result = FFI_Yajl::Parser.parse(@hashed_outcome["result"])
87
86
  @errors = @hashed_outcome["errors"]
88
87
  @verbose = @hashed_outcome["verbose"]
89
88
  true
90
- rescue => e
89
+ rescue NoMethodError, FFI_Yajl::ParseError => e
91
90
  @retry_count += 1
92
- puts "#{e.inspect}"
91
+ # capture exception so that it can be raised later, since otherwise
92
+ # we will be raising back to C++.
93
93
  @exception = e
94
94
  return true if @retry_count > 3
95
95
  puts "Retrying PowerShell command execution #{@retry_count}"
96
96
  sleep 1
97
97
  false
98
+ rescue => e
99
+ # no retry for other exceptions
100
+ @exception = e
101
+ true
98
102
  end
99
103
  end
100
104
 
@@ -16,5 +16,5 @@
16
16
 
17
17
  module ChefPowerShellModule
18
18
  CHEFPOWERSHELL_ROOT = File.expand_path("..", __dir__)
19
- VERSION = "2.18.5".freeze
19
+ VERSION = "2.18.6".freeze
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-powershell
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.5
4
+ version: 2.18.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc