Skip to content

Commit

Permalink
FIX: added a new function to replace the simple quotes when execute C…
Browse files Browse the repository at this point in the history
…MD command rundeck-plugins#68
  • Loading branch information
nvalenzuela20 committed Dec 21, 2020
1 parent 0bbebba commit dc9ac36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions contents/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ def get_file(destination):

return filename


def replace_single_quotes_format(command):
command = command + " "
command = re.sub(r'\s(\')',' \"', command)
command = re.sub(r'(\')\s','\" ', command)
command = re.sub(r'\'("\'")\'', "\'", command)

return command
6 changes: 5 additions & 1 deletion contents/winrm-exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import colored_formatter
import kerberosauth
import common
from colored_formatter import ColoredFormatter


Expand Down Expand Up @@ -157,7 +158,10 @@ def filter(self, record):
if "RD_CONFIG_OPERATIONTIMEOUT" in os.environ:
operationtimeout = os.getenv("RD_CONFIG_OPERATIONTIMEOUT")

exec_command = os.getenv("RD_EXEC_COMMAND")
exec_command = os.getenv("RD_EXEC_COMMAND")

if "cmd" in shell:
exec_command = common.replace_single_quotes_format(exec_command)

endpoint=transport+'://'+args.hostname+':'+port

Expand Down

0 comments on commit dc9ac36

Please sign in to comment.