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',
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)
from osmclient.common.exceptions import ClientException
from osmclient.common.exceptions import NotFound
import json
-import yaml
+# import yaml
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))
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))