chef-powershell 3.0.15 → 3.0.16

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: 3d7e92fc5253d76e76722d2b7c0131366b74f658ea9686c34a8f1f3453b777a8
4
+ data.tar.gz: 502b236084d361134678d75dacaecd287d5cc15549426697882824834dbbae49
5
5
  SHA512:
6
- metadata.gz: c6395752be6e72113c36f4b6483383b9d37fc32d7b427f5ab0953415ff9f0b86dcf9ead2c906ad1a03f3c0f159ae3af5126a24ee8f37f00d346c09f935947690
7
- data.tar.gz: 7aca8baac5f166221a2846c0ce7e68240c3683c7a30686aafcbdf34d31bab3f3e897c8bb545f4834f9ca7fbbc8d324e4a98a52a9762fadb69d5682e7248f0db3
6
+ metadata.gz: 954bba18993c2e6fa1061ab0c0d32799d6d8e5f7c260d05e5e7bc6c31384699103e64d9c899f13f90ff357a3523697047f86b552459abad792b4e1b9edebd50f
7
+ data.tar.gz: 0e7f20fe60e61fe4e5433cacd24439675872a9bbec181b1f3eeab7e284a207e85cc4fb983cef08902c9d3abf9692cf030d663091e000239c66e04ccbb77b82bd
@@ -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
+ 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.16".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.16
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