Skip to content

Commit 9916aa6

Browse files
m-bullstephenfin
authored andcommitted
Ensure show on absent appcreds raises exception
Currently, running ``application credential show`` on a non-existent appcred will exit normally and display a formatted application credential with no data, despite the Keystone API returning a 404. Ensure that querying a non-existent application credential raises an exception message and an exit-code 1 to the user. Closes-Bug: #2126565 Change-Id: I597d2d4064f1020c5ac40862ecc556f3c94b53eb Signed-off-by: Matt Anson <matta@stackhpc.com> (cherry picked from commit fb8cdd4)
1 parent a122400 commit 9916aa6

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

openstackclient/identity/v3/application_credential.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def take_action(self, parsed_args):
352352
user_id = conn.config.get_auth().get_user_id(conn.identity)
353353

354354
application_credential = identity_client.find_application_credential(
355-
user_id, parsed_args.application_credential
355+
user_id, parsed_args.application_credential, ignore_missing=False
356356
)
357357

358358
return _format_application_credential(application_credential)

openstackclient/tests/unit/identity/v3/test_application_credential.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def test_application_credential_show(self):
457457
columns, data = self.cmd.take_action(parsed_args)
458458

459459
self.identity_sdk_client.find_application_credential.assert_called_with(
460-
user_id, self.application_credential.id
460+
user_id, self.application_credential.id, ignore_missing=False
461461
)
462462

463463
self.assertEqual(self.columns, columns)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
fixes:
3+
- |
4+
Running ``openstack application credential show`` on
5+
a non-existent application credential does not
6+
raise an exception.
7+
8+
[Bug `2126565 <https://bugs.launchpad.net/python-openstackclient/+bug/2126565>`_]

0 commit comments

Comments
 (0)