def get(self, args, config, connection): role = Role(args['name'], connection=connection) if not role.exists(): print("Error: Role does not exist: {0}".format(args['name'])) sys.exit(1) role.read() self.jprint(role)
def modify(self, args, config, connection): role = Role(args['name'], connection=connection) if not role.exists(): print("Error: Role does not exist: {0}".format(args['name'])) sys.exit(1) if args['json'] is not None: role = self._read(args['name'], args['json']) self.roles = [] self._properties(role, args) if len(self.roles) > 0: role.set_role_names(self.roles) print("Modify role {0}...".format(args['name'])) role.update(connection=connection)
def create(self, args, config, connection): role = Role(args['name'], connection=connection) if role.exists(): print("Error: Role already exists: {0}".format(args['name'])) sys.exit(1) if args['json'] is not None: role = self._read(args['name'], args['json']) self.roles = [] self._properties(role, args) if len(self.roles) > 0: role.set_role_names(self.roles) print("Create role {0}...".format(args['name'])) role.create(connection)