fix use before declare and added a missed redact

This commit is contained in:
Chris Meyers
2015-01-30 15:48:06 -05:00
parent 8bb8f67370
commit ee9ae8bb00
2 changed files with 4 additions and 10 deletions

View File

@@ -16,24 +16,17 @@ class UriCleaner(object):
break
o = urlparse.urlsplit(match.group(1))
if not o.username and not o.password:
flag_continue = False
if o.netloc:
if o.netloc and ":" in o.netloc:
# Handle the special case url http://username:password that can appear in SCM url
# on account of a bug? in ansible redaction
try:
(username, password) = o.netloc.split(':')
except ValueError as e:
flag_continue = True
pass
if flag_continue:
(username, password) = o.netloc.split(':')
else:
text_index += len(match.group(1))
continue
else:
username = o.username
password = o.password
# Given a python MatchObject, with respect to redactedtext, find and
# replace the first occurance of username and the first and second
# occurance of password