Skip to content

Instantly share code, notes, and snippets.

@looprock
Created May 12, 2015 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save looprock/33df34b896357ecf0c45 to your computer and use it in GitHub Desktop.
Save looprock/33df34b896357ecf0c45 to your computer and use it in GitHub Desktop.
wrap rundeck exec in single quotes
#!/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