Skip to content

Commit 9bcb1c5

Browse files
committed
Fix missing 'options' field in 'user show' command
This patch fixes a bug where the 'options' field was missing from the output of the 'openstack user show' command since v7.0.0. The issue was caused by the 'options' field not being included in the column list in the _format_user function. This field is important as it contains various user settings such as multi-factor authentication configurations and password policy exemptions. This patch: 1. Adds 'options' field to the column list in _format_user function 2. Updates all affected unit tests to include this field 3. Uses getattr() to safely handle cases where the options field may be absent Without this fix, users cannot see important options like multi-factor authentication settings through the CLI, which could lead to security configuration issues being overlooked. Closes-Bug: #2084946 Change-Id: I4319268ad4310e6164eb8e65664d73f9b32cdd78
1 parent 5fb4559 commit 9bcb1c5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

openstackclient/identity/v3/user.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def _format_user(user):
4141
'name',
4242
'description',
4343
'password_expires_at',
44+
'options',
4445
)
4546
column_headers = (
4647
'default_project_id',
@@ -51,6 +52,7 @@ def _format_user(user):
5152
'name',
5253
'description',
5354
'password_expires_at',
55+
'options',
5456
)
5557
return (
5658
column_headers,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class TestUserCreate(identity_fakes.TestIdentityv3):
4444
'name',
4545
'description',
4646
'password_expires_at',
47+
'options',
4748
)
4849

4950
def setUp(self):
@@ -63,6 +64,7 @@ def setUp(self):
6364
self.user.name,
6465
self.user.description,
6566
self.user.password_expires_at,
67+
getattr(self.user, 'options', {}),
6668
)
6769

6870
self.identity_sdk_client.find_domain.return_value = self.domain
@@ -279,6 +281,7 @@ def test_user_create_project(self):
279281
self.user.name,
280282
self.user.description,
281283
self.user.password_expires_at,
284+
getattr(self.user, 'options', {}),
282285
)
283286
self.assertEqual(datalist, data)
284287

@@ -326,6 +329,7 @@ def test_user_create_project_domain(self):
326329
self.user.name,
327330
self.user.description,
328331
self.user.password_expires_at,
332+
getattr(self.user, 'options', {}),
329333
)
330334
self.assertEqual(datalist, data)
331335

@@ -1853,6 +1857,7 @@ def test_user_show(self):
18531857
'name',
18541858
'description',
18551859
'password_expires_at',
1860+
'options',
18561861
)
18571862
self.assertEqual(collist, columns)
18581863
datalist = (
@@ -1864,6 +1869,7 @@ def test_user_show(self):
18641869
self.user.name,
18651870
self.user.description,
18661871
self.user.password_expires_at,
1872+
getattr(self.user, 'options', {}),
18671873
)
18681874
self.assertEqual(datalist, data)
18691875

0 commit comments

Comments
 (0)