Skip to content

Commit

Permalink
Merge pull request #4390 from StackStorm/issue_4338/st2_login_exit_code
Browse files Browse the repository at this point in the history
Exit with exit code 1 when st2 login fails
  • Loading branch information
lakshmi-kannan authored Oct 12, 2018
2 parents 5e06fb8 + ea3c3c0 commit 8447068
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
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

0 comments on commit 8447068

Please sign in to comment.