From 70cbb929f08e4ab6e97fa5f6a4140e666af2e62b Mon Sep 17 00:00:00 2001 From: Luis Toledo Date: Tue, 18 Jun 2019 16:35:02 -0400 Subject: [PATCH] removing the behavior of generating an exit code >0 if there were any data on stderr now, the exit code will be controlled with the last command of the script/command executed (similar of what Rundeck works on Linux) --- contents/winrm-exec.py | 9 ++++++--- plugin.yaml | 10 +--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/contents/winrm-exec.py b/contents/winrm-exec.py index 38602f1..cff2ae5 100644 --- a/contents/winrm-exec.py +++ b/contents/winrm-exec.py @@ -75,7 +75,7 @@ if os.environ.get('RD_JOB_LOGLEVEL') == 'DEBUG': log_level = 'DEBUG' else: - log_level = 'ERROR' + log_level = 'WARNING' ##end @@ -263,8 +263,11 @@ sys.stdout = realstdout sys.stderr = realstderr -if tsk.e_std: - log.error("Execution finished with the following error") +if tsk.stat ==0 and tsk.e_std: + #printing sterr when the exit code is cero + log.warning(tsk.e_std) + +if tsk.stat !=0: log.error(tsk.e_std) sys.exit(1) else: diff --git a/plugin.yaml b/plugin.yaml index ae4d4f6..80a6ff1 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,17 +1,9 @@ name: py-winrm-plugin -rundeckPluginVersion: 2.0 +rundeckPluginVersion: 1.2 author: "@author@" date: "@date@" version: "@version@" url: "@url@" -description: "Python WINRM node executor and file copier" -rundeckCompatibilityVersion: "3.x" -targetHostCompatibility: "all" -license: "Apache 2.0" -tags: - - script - - NodeExecutor - - FileCopier providers: - name: WinRMPython title: WinRM Node Executor Python