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

PyWinRM fails when using options as Windows paths due to quotes #68

Closed
nvalenzuela20 opened this issue Dec 17, 2020 · 1 comment
Closed

Comments

@nvalenzuela20
Copy link
Contributor

Environment:
Rundeck Enterprise 3.3.6
PyWinRM 2.0.10 - CMD interpreter (Powershell not allowed)
Not happening on JSCH for linux nodes.

When using options with Windows paths that uses backslashes, i.e: C:\test\${option.script} Rundeck does escape those backslashes by adding single quotes to it. When this is added and then passed to Windows CMD, i.e to list the fullpath: dir C:\test\${option.script} the command fails due to single quotes

Within the PyWinRm plugin code there is this line that retrieves the command from env variable, which is the failing one:
exec_command = os.getenv("RD_EXEC_COMMAND")

When this variable is replaced with nothing or double quotes, the command runs successfully:
exec_command = exec_command.replace("'", """)

Although this workaround can retrieve unexpected outputs (if single quotes are explicitly needed on output) from more complex job workflows.

@nvalenzuela20
Copy link
Contributor Author

Tested by @dlvcrk

ltamaster added a commit that referenced this issue Dec 21, 2020
FIX: added a function to remove/replace simple quotes when execute CMD command #68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant