rundeck-plugins / py-winrm-plugin

15 stars 21 forks source link

winrm-exec.py marks job as failed if warning in inline script #54

Closed oj43085 closed 4 years ago

oj43085 commented 4 years ago

If I am running an inline script that presents a warning for import then the winrm-exec.py will find this in stderr and return the running job as failed.

`

11:55:30   [ERROR ] Execution finished with the following error (winrm-exec.py:268)[root]
11:55:30   [ERROR ] C:\Users\Osman\Code\scripts\2-209765-O365AEH3-dispatch-script.tmp.py:12: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
11:55:30   import pymssql
11:55:30   (winrm-exec.py:269)[root]

`

ltamaster commented 4 years ago

Hi @oj43085 ,

Thanks Luis

oj43085 commented 4 years ago

Hello,

I am using pywinrm with python interpreter switched to python3 .

Rundeck 3.2.8 on CentOS 7

Target node: Windows Server 2012 with python 3.7 installed.

Plugin of Pywinrm is py-winrm-plugin-2.0.7.zip

attached is a sample job to reproduce the error.

On Fri, Jun 26, 2020 at 4:03 PM Luis Toledo notifications@github.com wrote:

Hi @oj43085 https://github.com/oj43085 ,

  • Can you share the job or something similar to what you are doing?
  • Which version of windows are you connecting with?
  • which version of python?

Thanks Luis

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rundeck-plugins/py-winrm-plugin/issues/54#issuecomment-650197128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGTRJRLACSJQGFXCA52VHELRYSTCZANCNFSM4OJGIJKQ .

oj43085 commented 4 years ago

`- defaultTab: nodes description: '' executionEnabled: true id: ff9f4890-105a-44a4-a888-3d9bc0c25daa loglevel: INFO name: reproduce error nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: false threadcount: '1' filter: name:O365AEH3 nodesSelectedByDefault: true plugins: ExecutionLifecycle: null scheduleEnabled: true sequence: commands:

oj43085 commented 4 years ago

This false positive also happens if my inline script prints anything to stderr instead of stdout, then winrm-exec.py will fail the job even though job runs successfully if ran directly on the machine (copy paste script, run script directly, skipping rundeck)

oj43085 commented 4 years ago

Hi @ltamaster is it possible to get a patched plugin by 1st week of July? I have a big task coming up (that comes up every month) and I would like to avoid running the scripts directly on the server if possible.

ltamaster commented 4 years ago

Hi @oj43085

Please try with 2.0.8. I added a config properties to control the behavior, you should use the option Script Exit Behaviour: exitcode
https://github.com/rundeck-plugins/py-winrm-plugin#running-scripts

Luis