diff --git a/sysinv/sysinv/sysinv/sysinv/common/openstack_config_endpoints.py b/sysinv/sysinv/sysinv/sysinv/common/openstack_config_endpoints.py index 1a7994a71b..a98ac3490b 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/openstack_config_endpoints.py +++ b/sysinv/sysinv/sysinv/sysinv/common/openstack_config_endpoints.py @@ -184,6 +184,23 @@ def create_users(keystone, users_to_create): LOG.info(f"User {username} successfully created") +@retry(stop_max_attempt_number=3, wait_fixed=1000) +def set_users_options(keystone, users_to_update, options): + """ + Set the options for a list of users + + :param keystone: keystone's client + :param users_to_update: list of user's names to update + :param options: a dictionary of options to set for the users + """ + + keystone_users = keystone.users.list() + + for user in keystone_users: + if user.name in users_to_update: + keystone.users.update(user.id, options=options) + + @retry(stop_max_attempt_number=3, wait_fixed=1000) def grant_admin_role(keystone, users_to_create, project_name): roles_dict = {role.name: role.id for role in keystone.roles.list()}