Created
May 12, 2015 19:24
-
-
Save looprock/33df34b896357ecf0c45 to your computer and use it in GitHub Desktop.
wrap rundeck exec in single quotes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import sys | |
import os | |
f = open(sys.argv[1]) | |
try: | |
data = f.read() | |
finally: | |
f.close() | |
lines = data.split("\n") | |
for string in lines: | |
result = re.match(r'.*\-o\s"\S+\s\S+.*\"', string) | |
if result: | |
one = string.split('<exec>') | |
two = one[1].split('</exec>') | |
print "%s<exec>'%s'</exec>%s" % (one[0],two[0],two[1]) | |
else: | |
print string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment