bug 624 fix user management for sol005
Change-Id: I3aa13a9f9c5c22411af90ba98dbe5d0d5a0cfd5d
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
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 @@
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 @@
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.exceptions import ClientException
from osmclient.common.exceptions import NotFound
import json
-import yaml
+# import yaml
class User(object):
@@ -39,8 +39,6 @@
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 @@
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))