Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with exit code 1 when st2 login fails #4390

Merged
merged 3 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Fixed
* Update ``st2-pack-install`` and ``st2 pack install`` command so it works with local git repos
(``file://<path to local git repo>``) which are in a detached head state (e.g. specific revision
is checked out). (improvement) #4366
* st2 login now exits with non zero exit code when login fails due to invalid credentials.
(improvement) #4338

2.9.0 - September 16, 2018
--------------------------
Expand Down
3 changes: 1 addition & 2 deletions st2client/st2client/commands/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@ def run_and_print(self, args, **kwargs):
try:
self.run(args, **kwargs)
except Exception as e:
print('Failed to log in as %s: %s' % (args.username, str(e)))
if self.app.client.debug:
raise

return
raise Exception('Failed to log in as %s: %s' % (args.username, str(e)))

print('Logged in as %s' % (args.username))

Expand Down
2 changes: 1 addition & 1 deletion st2client/tests/unit/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def runTest(self, mock_gp):

self.assertTrue('Failed to log in as %s' % expected_username in self.stdout.getvalue())
self.assertTrue('Logged in as' not in self.stdout.getvalue())
self.assertEqual(retcode, 0)
self.assertEqual(retcode, 1)


class TestAuthToken(base.BaseCLITestCase):
Expand Down