Skip to content

Commit

Permalink
(bug) - Fix dsc timeout matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Aug 15, 2024
1 parent 9f73fc5 commit f98dfc7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,17 @@ def invoke_dsc_resource(context, name_hash, props, method)
script_content = ps_script_content(resource)
context.debug("Invoke-DSC Timeout: #{@timeout} milliseconds") if @timeout
context.debug("Script:\n #{redact_secrets(script_content)}")
output = ps_manager.execute(remove_secret_identifiers(script_content), @timeout)[:stdout]
output = ps_manager.execute(remove_secret_identifiers(script_content), @timeout)

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

begin
data = JSON.parse(output)
data = JSON.parse(output[:stdout])
rescue StandardError => e
context.err(e)
return nil
Expand Down

0 comments on commit f98dfc7

Please sign in to comment.