Skip to content

Commit

Permalink
change exit to raise in creds_mng
Browse files Browse the repository at this point in the history
  • Loading branch information
liorf committed Mar 1, 2017
1 parent a7a9b30 commit ef63cef
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions nsot_sync/creds_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def __init__(self, **kwargs):
if key == 'update_creds':
self.update_creds = value
else:
print ('Error: kwargs is None')
exit(1)
raise Exception('Error: kwargs is None')
self.creds_filename = os.path.normpath(os.path.expanduser('~') + '/' + self.creds_filename + '.dat')

@property
Expand All @@ -34,13 +33,11 @@ def load_creds(self):
user = raw_input('Enter Username: ')
if user == "":
logging.info('No username given')
print("Error: No username given")
exit(1)
raise Exception("Error: No username given")
password = getpass.getpass()
if password == "":
logging.info('No password given')
print("Error: No password given")
exit(1)
raise Exception("Error: No password given")
with open(self.creds_filename, 'w') as f:
f.write(user + "\n")
f.write(base64.b64encode(password))
Expand All @@ -58,13 +55,11 @@ def load_creds(self):
user = raw_input('Enter Username: ')
if user == "":
logging.info('No username given')
print("Error: No username given")
exit(1)
raise Exception("Error: No username given")
password = getpass.getpass()
if password == "":
logging.info('No password given')
print("Error: No password given")
exit(1)
raise Exception("Error: No password given")
with open(self.creds_filename, 'w') as f:
f.write(user + "\n")
f.write(base64.b64encode(password))
Expand Down

0 comments on commit ef63cef

Please sign in to comment.