Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.