Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
    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)