From f98dfc7d653503c0782e04ee59203c1e2bb33d1f Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Thu, 15 Aug 2024 10:28:50 +0000 Subject: [PATCH] (bug) - Fix dsc timeout matcher --- .../provider/dsc_base_provider/dsc_base_provider.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb b/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb index fa337389..fecaf3c5 100644 --- a/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb +++ b/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb @@ -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