def create_cloud_user(cfg, args):
    """Attempt to create the user on the cloud node."""
    url = cfg['api_server'] + "admin/add-user"
    params = {'user_email': args.user_email, 'user_name': args.user_name,
              'user_role': args.user_role, 'email': cfg['email'],
              'api_key': cfg['api_key']}
    headers = {'Content-Type': 'application/json'}
    response = requests.post(url, data=json.dumps(params),
                             headers=headers)
    if response.status_code not in range(200, 299):
        raise Exception("Errors contacting the cloud node: %s" % (response.content))
    loaded = json.loads(response.content)
    return loaded
def create_cloud_user ( cfg , args ) : url = cfg [ 'api_server' ] + "admin/add-user" params = { 'user_email' : args . user_email , 'user_name' : args . user_name , 'user_role' : args . user_role , 'email' : cfg [ 'email' ] , 'api_key' : cfg [ 'api_key' ] } headers = { 'Content-Type' : 'application/json' } response = requests . post ( url , data = json . dumps ( params ) , headers = headers ) if response . status_code not in range ( 200 , 299 ) : raise Exception ( "Errors contacting the cloud node: %s" % ( response . content ) ) loaded = json . loads ( response . content ) return loaded
Attempt to create the user on the cloud node.