Esempio n. 1
0
def get_role(name):
    """Gets a role"""
    if name is None:
        raise InvalidInputError('role name should be provided to '
                                'execute this task')
    cmd = 'user_role info  --name {0}'.format(name)
    run_command(cmd)
Esempio n. 2
0
def get_distributor(name, org):
    """Gets a distributor"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'distributor info --name {0} --org {1}'.format(name, org)
    run_command(cmd)
Esempio n. 3
0
def delete_manifest(org=None):
    """Deletes a manifest"""
    if org is None:
        raise InvalidInputError('org should be provided to execute this task')
    cmd = ('provider delete_manifest --name "{0}" '
           '--org {1}'.format(PROVIDER_NAME, org))
    run_command(cmd)
Esempio n. 4
0
def get_activation_key(name, org):
    """Gets an activation key"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'activation_key info  --name {0} --org {1}'.format(name, org)
    run_command(cmd)
Esempio n. 5
0
def get_system_group(name, org):
    """Gets a system group"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'system_group info --name {0} --org {1}'.format(name, org)
    run_command(cmd)
Esempio n. 6
0
def get_permission(user_role):
    """Gets a permission"""
    if user_role is None:
        raise InvalidInputError('user_rold should be provided to '
                                'execute this task')
    cmd = 'permission list  --user_role {0}'.format(user_role)
    run_command(cmd)
Esempio n. 7
0
def get_user(username):
    """Gets an user"""
    if username is None:
        raise InvalidInputError('username should be provided to '
                                'execute this task')
    cmd = 'user info  --username {0}'.format(username)
    run_command(cmd)
Esempio n. 8
0
def get_system(name, org):
    """Gets a system"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'system info --name {0} --org {1}'.format(name, org)
    # Open bug
    run_command(cmd, warn_only=True)
Esempio n. 9
0
def update_org(name, new_description=None):
    """Updates an org."""
    if name is None:
        raise InvalidInputError('org name should be provided'
                                'to execute this task')
    run_command('org update --name={0} --description={1}'.format(
        name, new_description))
    return name
Esempio n. 10
0
def delete_permission(name, user_role):
    """Creates a permission"""
    if name is None or user_role is None:
        raise InvalidInputError('name and user_role should be provided to '
                                'execute this task')
    cmd = ('permission delete --name {0} '
           '--user_role {1}').format(name, user_role)
    run_command(cmd)
Esempio n. 11
0
def update_system(name=None, org=None, new_name=None, new_description=None):
    """Updates a system"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'system update --name {0} --org {1} '.format(name, org)
    if new_name is not None:
        cmd = cmd + '--new_name {0} '.format(new_name)
    if new_description is not None:
        cmd = cmd + '--description {0}'.format(new_description)
    run_command(cmd, warn_only=True)
    if new_name is not None:
        return new_name
Esempio n. 12
0
def update_distributor(name, org, new_name=None, new_description=None):
    """Updates a distributor"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'distributor update --name {0} --org {1} '.format(name, org)
    if new_name is not None:
        cmd = cmd + '--new_name {0} '.format(new_name)
    if new_description is not None:
        cmd = cmd + '--description {0}'.format(new_description)
    run_command(cmd)
    if new_name is not None:
        return new_name
Esempio n. 13
0
def update_role(name, new_name=None, new_description=None):
    """Updates an user role"""
    if name is None:
        raise InvalidInputError('role name should be provided to '
                                'execute this task')
    cmd = 'user_role update --name {0} '.format(name)
    if new_name is not None:
        cmd = cmd + ' --new_name {0} '.format(new_name)
    if new_description is not None:
        cmd = cmd + ' --description {0} '.format(new_description)
    run_command(cmd)
    if new_name is not None:
        return new_name
Esempio n. 14
0
def update_activation_key(name,
                          org,
                          new_name=None,
                          new_description=None,
                          new_limit=None):
    """Updates an activation key."""
    if name is None or org is None:
        raise InvalidInputError('Activation key name and org name should be '
                                'provided to execute this task')
    cmd = 'activation_key update --name {0} --org {1} '.format(name, org)
    if new_name is not None:
        cmd = cmd + '--new_name={0} '.format(new_name)
    if new_name is not None:
        cmd = cmd + '--description={0} '.format(new_description)
    if new_name is not None:
        cmd = cmd + '--limit={0}'.format(new_limit)
    run_command(cmd)
    if new_name is not None:
        return new_name
Esempio n. 15
0
def update_system_group(name=None,
                        org=None,
                        new_name=None,
                        new_description=None,
                        new_max_systems=None):
    """Updates a system group"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    cmd = 'system_group update --name {0} --org {1} '.format(name, org)
    if new_name is not None:
        cmd = cmd + '--new_name {0} '.format(new_name)
    if new_description is not None:
        cmd = cmd + '--description {0}'.format(new_description)
    if new_max_systems is not None:
        cmd = cmd + '--max_systems {0}'.format(new_max_systems)
    run_command(cmd)
    if new_name is not None:
        return new_name
Esempio n. 16
0
def update_user(username,
                new_password=None,
                new_email=None,
                new_default_organization=None,
                new_default_locale=None):
    """Updates an user"""
    if username is None:
        raise InvalidInputError('username should be provided to '
                                'execute this task')
    cmd = 'user update --username {0} '.format(username)
    if new_password is not None:
        cmd = cmd + ' --password {0} '.format(new_password)
    if new_email is not None:
        cmd = cmd + ' --email {0} '.format(new_email)
    if new_default_organization is not None:
        cmd = cmd + (' --default_organization'
                     ' {0} '.format(new_default_organization))
    if new_default_locale is not None:
        cmd = cmd + ' --default_locale {0}'.format(new_default_locale)
    run_command(cmd)
    return username
Esempio n. 17
0
def delete_distributor(name, org):
    """Deletes a distributor"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    run_command('distributor delete --name {0} --org {1}'.format(name, org))
Esempio n. 18
0
def delete_role(name):
    """Creates an user role"""
    if name is None:
        raise InvalidInputError('name should be provided to execute this task')
    run_command('user_role delete --name {0}'.format(name))
Esempio n. 19
0
def delete_user(username):
    """Deletes an user"""
    if username is None:
        raise InvalidInputError('username should be provided to execute '
                                'this task')
    run_command('user delete --username {0}'.format(username))
Esempio n. 20
0
def delete_activation_key(name, org):
    """Deletes an activation key."""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    run_command('activation_key delete --name {0} --org {1}'.format(name, org))
Esempio n. 21
0
def get_org(name):
    """Gets an org"""
    if name is None:
        raise InvalidInputError('name should be provided to execute this task')
    cmd = 'org info  --name {0}'.format(name)
    run_command(cmd)
Esempio n. 22
0
def delete_system_group(name, org):
    """Deletes a system group"""
    if name is None or org is None:
        raise InvalidInputError('name and org should be provided to '
                                'execute this task')
    run_command('system_group delete --name {0} --org {1}'.format(name, org))
Esempio n. 23
0
def delete_org(name):
    """Deletes an org."""
    if name is None:
        raise InvalidInputError('name should be provided to execute this task')
    run_command('org delete --name={0}'.format(name))
Esempio n. 24
0
def get_product_list(org=None):
    """Get list of Products for an org"""
    if org is None:
        raise InvalidInputError('org should be provided to execute this task')
    cmd = 'product list  --org {0}'.format(org)
    run_command(cmd)