Skip to content

Commit 926c8f4

Browse files
author
Matthew Fisher
committed
fix(client): return non-zero on errors
Some commands were inconsistent and returned 0 when an error occurred. This makes the client more consistent with errors. closes #767
1 parent c205210 commit 926c8f4

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

client/deis.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ def apps_create(self, args):
469469
stdout=subprocess.PIPE)
470470
print('Git remote deis added')
471471
except subprocess.CalledProcessError:
472+
print('Could not create Deis remote')
472473
sys.exit(1)
473474
else:
474475
raise ResponseError(response)
@@ -607,10 +608,9 @@ def apps_run(self, args):
607608
json.dumps(body))
608609
if response.status_code == requests.codes.ok: # @UndefinedVariable
609610
rc, output = json.loads(response.content)
610-
if rc != 0:
611-
print('Warning: non-zero return code {}'.format(rc))
612611
sys.stdout.write(output)
613612
sys.stdout.flush()
613+
sys.exit(rc)
614614
else:
615615
raise ResponseError(response)
616616

@@ -638,7 +638,7 @@ def auth_register(self, args):
638638
confirm = getpass('password (confirm): ')
639639
if password != confirm:
640640
print('Password mismatch, aborting registration.')
641-
return False
641+
sys.exit(1)
642642
email = args.get('--email')
643643
if not email:
644644
email = raw_input('email: ')
@@ -712,10 +712,9 @@ def auth_login(self, args):
712712
print("Logged in as {}".format(username))
713713
return username
714714
else:
715-
print('Login failed')
716715
self._session.cookies.clear()
717716
self._session.cookies.save()
718-
return False
717+
raise ResponseError(response)
719718

720719
def auth_logout(self, args):
721720
"""
@@ -1176,7 +1175,7 @@ def _parse_key(self, path):
11761175
match = re.match(r'^(ssh-...) ([^ ]+) ?(.*)', data)
11771176
if not match:
11781177
print("Could not parse SSH public key {0}".format(name))
1179-
return
1178+
sys.exit(1)
11801179
key_type, key_str, key_comment = match.groups()
11811180
if key_comment:
11821181
key_id = key_comment

0 commit comments

Comments
 (0)