def get_users(keystone_client): logger.debug("Getting users...") dic_users = {} users = os_utils.get_users(keystone_client) if not (users is None or len(users) == 0): for user in users: dic_users.update({getattr(user, 'id'): getattr(user, 'name')}) return {'users': dic_users}
def get_users(keystone_client): logger.debug("Getting users...") dic_users = {} users = os_utils.get_users(keystone_client) if not (users is None or len(users) == 0): for user in users: dic_users.update({getattr(user, 'id'): getattr(user, 'name')}) return {'users': dic_users}
def remove_users(keystone_client, default_users): logger.info("Removing Users...") users = os_utils.get_users(keystone_client) if users is None: logger.debug("There are no users in the deployment. ") return for user in users: user_name = getattr(user, 'name') user_id = getattr(user, 'id') logger.debug("'%s', ID=%s " % (user_name, user_id)) if user_id not in default_users: logger.debug(" Removing '%s'..." % user_name) if os_utils.delete_user(keystone_client, user_id): logger.debug(" > Done!") else: logger.error("There has been a problem removing the " "user '%s'(%s)..." % (user_name, user_id)) else: logger.debug(" > this is a default user and will " "NOT be deleted.")
def remove_users(keystone_client, default_users): logger.info("Removing Users...") users = os_utils.get_users(keystone_client) if users is None: logger.debug("There are no users in the deployment. ") return for user in users: user_name = getattr(user, 'name') user_id = getattr(user, 'id') logger.debug("'%s', ID=%s " % (user_name, user_id)) if user_id not in default_users: logger.debug(" Removing '%s'..." % user_name) if os_utils.delete_user(keystone_client, user_id): logger.debug(" > Done!") else: logger.error("There has been a problem removing the " "user '%s'(%s)..." % (user_name, user_id)) else: logger.debug(" > this is a default user and will " "NOT be deleted.")