Skip to content

Commit 45e85ae

Browse files
jordanbreen28jordanbreen28
authored andcommitted
(bug) - Fix dsc timeout matcher
1 parent bcf2b49 commit 45e85ae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,17 @@ def invoke_dsc_resource(context, name_hash, props, method)
257257
script_content = ps_script_content(resource)
258258
context.debug("Invoke-DSC Timeout: #{@timeout} milliseconds") if @timeout
259259
context.debug("Script:\n #{redact_secrets(script_content)}")
260-
output = ps_manager.execute(remove_secret_identifiers(script_content), @timeout)[:stdout]
260+
output = ps_manager.execute(remove_secret_identifiers(script_content), @timeout)
261261

262-
if output.nil?
262+
if output[:stdout].nil?
263263
message = 'Nothing returned.'
264-
message += " There is a timeout of #{@timeout} milliseconds set, ensure the DSC resource has enough time to apply." unless @timeout.nil?
264+
message += " #{output[:errormessage]}" if output[:errormessage]&.match?(/PowerShell module timeout \(\d+ ms\) exceeded while executing/)
265265
context.err(message)
266266
return nil
267267
end
268268

269269
begin
270-
data = JSON.parse(output)
270+
data = JSON.parse(output[:stdout])
271271
rescue StandardError => e
272272
context.err(e)
273273
return nil

0 commit comments

Comments
 (0)