From affed83973a556b88d09ffc2be998b627e5b8f33 Mon Sep 17 00:00:00 2001 From: Ralph Schnalzenberger Date: Mon, 3 Jun 2024 09:13:19 +0200 Subject: [PATCH] Update logging for debugMode flag --- .../plugin/dynatrace/actions/dynatrace_action.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb b/lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb index 862573a..de6112e 100644 --- a/lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb +++ b/lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb @@ -87,7 +87,6 @@ def self.run(params) command << "#{dtxDssClientPath}" command << "-#{params[:action]}" #"-upload" command << "appid=\"#{params[:appId]}\"" - command << "apitoken=\"#{params[:apitoken]}\"" command << "os=#{params[:os]}" command << "bundleId=\"#{bundleId}\"" command << "versionStr=\"#{params[:versionStr]}\"" @@ -98,12 +97,17 @@ def self.run(params) command << "forced=1" # if the file already exists command << "tempdir=\"#{params[:tempdir]}\"" if params[:tempdir] + print_command = command + + command << "apitoken=\"#{params[:apitoken]}\"" + print_command << "apitoken=\"#{params[:apitoken]}\"" if params[:debugMode] == true + # Create the full shell command to trigger the DTXDssClient shell_command = command.join(' ') - UI.message "#{shell_command}" + UI.message "#{print_command}" - sh("#{shell_command}", error_callback: ->(result) { + Fastlane::Actions.sh("#{shell_command}", log: params[:debugMode] == true, error_callback: ->(result) { # ShAction doesn't return any reference to the return value -> parse it from the output result_groups = result.match /(?:ERROR: Execution failed, rc=)(-?\d*)(?:\sreason=)(.*)/ if result_groups and result_groups.length() >= 2