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
This commit is contained in:
@@ -41,6 +41,7 @@ def _format_user(user):
|
||||
'name',
|
||||
'description',
|
||||
'password_expires_at',
|
||||
'options',
|
||||
)
|
||||
column_headers = (
|
||||
'default_project_id',
|
||||
@@ -51,6 +52,7 @@ def _format_user(user):
|
||||
'name',
|
||||
'description',
|
||||
'password_expires_at',
|
||||
'options',
|
||||
)
|
||||
return (
|
||||
column_headers,
|
||||
|
@@ -44,6 +44,7 @@ class TestUserCreate(identity_fakes.TestIdentityv3):
|
||||
'name',
|
||||
'description',
|
||||
'password_expires_at',
|
||||
'options',
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
@@ -63,6 +64,7 @@ class TestUserCreate(identity_fakes.TestIdentityv3):
|
||||
self.user.name,
|
||||
self.user.description,
|
||||
self.user.password_expires_at,
|
||||
getattr(self.user, 'options', {}),
|
||||
)
|
||||
|
||||
self.identity_sdk_client.find_domain.return_value = self.domain
|
||||
@@ -279,6 +281,7 @@ class TestUserCreate(identity_fakes.TestIdentityv3):
|
||||
self.user.name,
|
||||
self.user.description,
|
||||
self.user.password_expires_at,
|
||||
getattr(self.user, 'options', {}),
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
@@ -326,6 +329,7 @@ class TestUserCreate(identity_fakes.TestIdentityv3):
|
||||
self.user.name,
|
||||
self.user.description,
|
||||
self.user.password_expires_at,
|
||||
getattr(self.user, 'options', {}),
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
@@ -1853,6 +1857,7 @@ class TestUserShow(identity_fakes.TestIdentityv3):
|
||||
'name',
|
||||
'description',
|
||||
'password_expires_at',
|
||||
'options',
|
||||
)
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = (
|
||||
@@ -1864,6 +1869,7 @@ class TestUserShow(identity_fakes.TestIdentityv3):
|
||||
self.user.name,
|
||||
self.user.description,
|
||||
self.user.password_expires_at,
|
||||
getattr(self.user, 'options', {}),
|
||||
)
|
||||
self.assertEqual(datalist, data)
|
||||
|
||||
|
Reference in New Issue
Block a user