Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bug) - Fix dsc timeout matcher #331

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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