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)
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)
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)
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)
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)
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)
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)
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)
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
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)
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
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
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
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
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
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
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))
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))
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))
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))
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)
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))
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))
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)