Last active
July 4, 2017 13:55
-
-
Save psachin/abfc6d9285231bc6141effc60b4d09cb to your computer and use it in GitHub Desktop.
sos/sos/plugins:do_file_sub
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
import codecs | |
import re | |
result, replacement = re.subn(r"^(auth_url[\t\ ]*=[\t\ ]*)(.+)", r"\1****", "auth_url = http://localhost.com:5000/") | |
print(result, replacement) | |
with codecs.open("/etc/aodh/aodh.conf", "r", encoding='utf-8') as infile: | |
for line in infile: | |
result, replacement = re.subn(r"(^auth_url[\t\ ]*=[\t\ ]*)(.+)", r"\1****", line) | |
if replacement: | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment