Skip to content

Commit 3266f46

Browse files
Fix user password set command
When identity 'user' commands were migrated to SDK in previous commit[1] the command for user self-service password reset was changed from using keystoneclient update_password function to the openstacksdk update_user function. The SDK update_user function is intended for administrators to update user attributes and is restricted by policy. This patch uses the update_password function in openstacksdk. [1] https://review.opendev.org/c/openstack/python-openstackclient/+/909030 Assisted-By: Cursor Auto Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/980429 Partial-Bug: #2144315 Change-Id: I0be5d219ba854ea64c9ee9640128d0426d067bf6 Signed-off-by: Dylan McCulloch <Dylan.McCulloch@gmail.com>
1 parent 28b470b commit 3266f46

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

openstackclient/identity/v3/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def take_action(self, parsed_args: argparse.Namespace) -> None:
759759
)
760760
)
761761

762-
identity_client.update_user(
762+
identity_client.update_password(
763763
user=user_id,
764764
current_password=current_password,
765765
password=password,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ def test_user_password_change(self):
17161716
conn = self.app.client_manager.sdk_connection
17171717
user_id = conn.config.get_auth().get_user_id(conn.identity)
17181718

1719-
self.identity_sdk_client.update_user.assert_called_with(
1719+
self.identity_sdk_client.update_password.assert_called_with(
17201720
user=user_id, current_password=current_pass, password=new_pass
17211721
)
17221722

@@ -1733,7 +1733,7 @@ def test_user_create_password_prompt(self):
17331733
conn = self.app.client_manager.sdk_connection
17341734
user_id = conn.config.get_auth().get_user_id(conn.identity)
17351735

1736-
self.identity_sdk_client.update_user.assert_called_with(
1736+
self.identity_sdk_client.update_password.assert_called_with(
17371737
user=user_id, current_password=current_pass, password=new_pass
17381738
)
17391739

@@ -1758,7 +1758,7 @@ def test_user_password_change_no_prompt(self):
17581758
conn = self.app.client_manager.sdk_connection
17591759
user_id = conn.config.get_auth().get_user_id(conn.identity)
17601760

1761-
self.identity_sdk_client.update_user.assert_called_with(
1761+
self.identity_sdk_client.update_password.assert_called_with(
17621762
user=user_id, current_password=current_pass, password=new_pass
17631763
)
17641764

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fix ``openstack user password set`` command to support user
5+
self-service password reset.
6+
[Bug `2144315 <https://bugs.launchpad.net/bugs/2144315>`_]
7+

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
77
cryptography>=2.7 # BSD/Apache-2.0
88
cliff>=4.13.0 # Apache-2.0
99
iso8601>=0.1.11 # MIT
10-
openstacksdk>=4.11.0 # Apache-2.0
10+
openstacksdk>=4.12.0 # Apache-2.0
1111
osc-lib>=2.3.0 # Apache-2.0
1212
oslo.i18n>=3.15.3 # Apache-2.0
1313
python-keystoneclient>=3.22.0 # Apache-2.0

0 commit comments

Comments
 (0)