chef-powershell 3.0.15 → 3.0.17

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chef-powershell might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10502fbd03eebe7a8d55c7b09dbcb37285e5bb8f5672d58d6a492afaca9ccb12
4
- data.tar.gz: ddd0bd71dd875f827faee58829e001f36370f25c87c07a21031a8ef99be39c6a
3
+ metadata.gz: 35e73a848097f74f51dfe777d0c519915fc8c23f57a84c024e0914570e474e0f
4
+ data.tar.gz: 63a1bd552b291846fb85e181b46f243f3a4b784302fcdb8b6b46c65d764d4a5d
5
5
  SHA512:
6
- metadata.gz: c6395752be6e72113c36f4b6483383b9d37fc32d7b427f5ab0953415ff9f0b86dcf9ead2c906ad1a03f3c0f159ae3af5126a24ee8f37f00d346c09f935947690
7
- data.tar.gz: 7aca8baac5f166221a2846c0ce7e68240c3683c7a30686aafcbdf34d31bab3f3e897c8bb545f4834f9ca7fbbc8d324e4a98a52a9762fadb69d5682e7248f0db3
6
+ metadata.gz: 4b4cf06572b6f67fa9e913fd85f84bb07718da8590254875fd5efcaa33bf0fded0db6976652e48463e7164e569a21208adf8b95c1994848f336211aff31c255a
7
+ data.tar.gz: 79dd6ca6afe1334761cf2dfd0ec0989530e44d5c3c7c7fead9e63bcd5808d27979d08313506dbea65519d85d847053560c7f0ed22fa8d6451d977f3d2699925e
@@ -66,16 +66,13 @@ class ChefPowerShell
66
66
  module PowerMod
67
67
  extend FFI::Library
68
68
 
69
- def self.powershell_dll=(powershell_dll)
70
- @powershell_dll = powershell_dll
71
- end
72
-
73
- def self.powershell_dll
74
- @powershell_dll
69
+ def self.load_powershell_dll(powershell_dll)
70
+ @dlls ||= []
71
+ return if @dlls.include?(powershell_dll)
72
+ @dlls << powershell_dll
75
73
  end
76
74
 
77
75
  def self.do_work(ps_command, timeout = -1)
78
- ffi_lib PowerMod.powershell_dll
79
76
  attach_function :execute_powershell, :ExecuteScript, %i{string int}, :pointer
80
77
  execute_powershell(ps_command, timeout)
81
78
  end
@@ -84,13 +81,13 @@ class ChefPowerShell
84
81
  private
85
82
 
86
83
  def exec(script, timeout: -1)
87
- PowerMod.powershell_dll = @powershell_dll
88
- @execution = PowerMod.do_work(script, timeout)
89
- @output = @execution.read_utf16string
90
- @hashed_outcome = FFI_Yajl::Parser.parse(@output)
91
- @result = FFI_Yajl::Parser.parse(@hashed_outcome["result"])
92
- @errors = @hashed_outcome["errors"]
93
- @verbose = @hashed_outcome["verbose"]
84
+ PowerMod.load_powershell_dll(@powershell_dll)
85
+ execution = PowerMod.do_work(script, timeout)
86
+ output = execution.read_utf16string
87
+ hashed_outcome = FFI_Yajl::Parser.parse(output)
88
+ @result = FFI_Yajl::Parser.parse(hashed_outcome["result"])
89
+ @errors = hashed_outcome["errors"]
90
+ @verbose = hashed_outcome["verbose"]
94
91
  end
95
92
  end
96
93
  end
@@ -16,5 +16,5 @@
16
16
 
17
17
  module ChefPowerShellModule
18
18
  CHEFPOWERSHELL_ROOT = File.expand_path("..", __dir__)
19
- VERSION = "3.0.15"
19
+ VERSION = "3.0.17".freeze
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-powershell
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.15
4
+ version: 3.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-10 00:00:00.000000000 Z
11
+ date: 2023-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi