From cbcb47feee334c67024ed7cabfade091accde04a Mon Sep 17 00:00:00 2001 From: tierno Date: Tue, 29 Jan 2019 11:43:10 +0000 Subject: [PATCH] bug 624 fix user management for sol005 Change-Id: I3aa13a9f9c5c22411af90ba98dbe5d0d5a0cfd5d Signed-off-by: tierno --- osmclient/scripts/osm.py | 5 +++-- osmclient/sol005/user.py | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 0a4c465..194196b 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -2236,7 +2236,8 @@ def project_show(ctx, name): confirmation_prompt=True, help='user password') @click.option('--projects', - default=None, + prompt=True, + multiple=True, help='list of project ids that the user belongs to') #@click.option('--description', # default='no description', @@ -2289,7 +2290,7 @@ def user_list(ctx, filter): exit(1) table = PrettyTable(['name', 'id']) for user in resp: - table.add_row([user['name'], user['_id']]) + table.add_row([user['username'], user['_id']]) table.align = 'l' print(table) diff --git a/osmclient/sol005/user.py b/osmclient/sol005/user.py index ee572f1..ad8027d 100644 --- a/osmclient/sol005/user.py +++ b/osmclient/sol005/user.py @@ -23,7 +23,7 @@ from osmclient.common import utils from osmclient.common.exceptions import ClientException from osmclient.common.exceptions import NotFound import json -import yaml +# import yaml class User(object): @@ -39,8 +39,6 @@ class User(object): def create(self, name, user): """Creates a new OSM user """ - if 'projects' in user and user['projects'] is not None: - user['projects'] = yaml.safe_load(user['projects']) http_code, resp = self._http.post_cmd(endpoint=self._apiBase, postfields_dict=user) #print('HTTP CODE: {}'.format(http_code)) @@ -132,7 +130,7 @@ class User(object): return user else: for user in self.list(): - if name == user['name']: + if name == user['username']: return user raise NotFound("User {} not found".format(name)) -- 2.25.1