-
-
Save gtmanfred/9c8ea84d9860d3a13adf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py | |
index 706c8a2..c30c694 100644 | |
--- a/shade/openstackcloud.py | |
+++ b/shade/openstackcloud.py | |
@@ -510,10 +510,11 @@ class OpenStackCloud(object): | |
# normalized dict won't work | |
kwargs['user'] = self.get_user_by_id(user['id'], normalize=False) | |
+ password = None | |
if self.cloud_config.get_api_version('identity') != '3': | |
# Do not pass v3 args to a v2 keystone. | |
kwargs.pop('domain_id', None) | |
- kwargs.pop('password', None) | |
+ password = kwargs.pop('password', None) | |
kwargs.pop('description', None) | |
kwargs.pop('default_project', None) | |
elif 'domain_id' in kwargs: | |
@@ -525,19 +526,12 @@ class OpenStackCloud(object): | |
with _utils.shade_exceptions("Error in updating user {user}".format( | |
user=name_or_id)): | |
user = self.manager.submitTask(_tasks.UserUpdate(**kwargs)) | |
- self.list_users.invalidate(self) | |
- return _utils.normalize_users([user])[0] | |
- | |
- def update_password(self, name_or_id, password): | |
- self.list_users.invalidate(self) | |
- with _utils.shade_exceptions( | |
- "Error updating password for {user}".format(user=name_or_id)): | |
- user = self.get_user(name_or_id) | |
- if self.cloud_config.get_api_version('identity') != '3': | |
+ if password is not None: | |
+ with _utils.shade_exceptions( | |
+ "Error updating password for {user}".format( | |
+ user=name_or_id)): | |
user = self.manager.submitTask(_tasks.UserPasswordUpdate( | |
user=user.id, password=password)) | |
- else: | |
- return self.update_user(name_or_id, password=password) | |
self.list_users.invalidate(self) | |
return _utils.normalize_users([user])[0] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment