Skip to content

Commit

Permalink
Fix handling of missing config when passing in email and token.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaskuechler committed Jun 28, 2016
1 parent aeff51b commit f7b824f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CloudFlare/read_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,35 @@ def read_configs():
])

if email is None:
email = config.get('CloudFlare', 'email')
try:
email = re.sub(r"\s+", '', config.get('CloudFlare', 'email'))
except ConfigParser.NoOptionError:
email = None
except ConfigParser.NoSectionError:
email = None

if token is None:
try:
token = re.sub(r"\s+", '', config.get('CloudFlare', 'token'))
except ConfigParser.NoOptionError:
token = None
except ConfigParser.NoSectionError:
token = None

if certtoken is None:
try:
certtoken = re.sub(r"\s+", '', config.get('CloudFlare', 'certtoken'))
except ConfigParser.NoOptionError:
certtoken = None
except ConfigParser.NoSectionError:
certtoken = None

try:
extras = re.sub(r"\s+", ' ', config.get('CloudFlare', 'extras'))
except ConfigParser.NoOptionError:
extras = None
except ConfigParser.NoSectionError:
extras = None

if extras:
extras = extras.split(' ')
Expand Down

0 comments on commit f7b824f

Please sign in to comment.