def delete(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            return

        print("Delete database {0}...".format(args['name']))
        forest_delete = args['forest_delete']
        database.delete(forest_delete,connection)
    def get(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            print("Error: Database does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['view'] == None:
            database.read(connection)
            self.jprint(database)
        else:
            results = database.view(args['view'])
            print(json.dumps(results, sort_keys=True, indent=2))
    def perform(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            print("Error: Database does not exist: {0}".format(args['name']))
            sys.exit(1)

        jf = open(args['json']).read()
        data = json.loads(jf)

        print("Perform {0} on database {1}..."
              .format(data['operation'],args['name']))
        response = database.operation(data, connection=connection)
        print(json.dumps(response, sort_keys=True, indent=2))
예제 #4
0
    def modify(self, args, config, connection):
        forest = Database(args['name'], connection=connection)
        if not forest.exists():
            print("Error: Forest does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            forest = self._read(args['name'], args['json'])
            if forest.host() is None:
                forest.set_host(args['forest_host'])

        self._properties(forest, args)
        print("Modify forest {0}...".format(args['name']))
        forest.update(connection=connection)
예제 #5
0
    def modify(self, args, config, connection):
        forest = Database(args['name'], connection=connection)
        if not forest.exists():
            print("Error: Forest does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            forest = self._read(args['name'], args['json'])
            if forest.host() is None:
                forest.set_host(args['forest_host'])

        self._properties(forest, args)
        print("Modify forest {0}...".format(args['name']))
        forest.update(connection=connection)
예제 #6
0
    def modify(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            print("Error: Database does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Modify database {0}...".format(args['name']))
        database.update(connection=connection)
    def modify(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            print("Error: Database does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Modify database {0}...".format(args['name']))
        database.update(connection=connection)
예제 #8
0
    def create(self, args, config, connection):
        database = Database(args['name'], args['forest_host'],
                            connection=connection)
        if database.exists():
            print("Error: Database already exists: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Create database {0}...".format(args['name']))
        database.create()
    def create(self, args, config, connection):
        database = Database(args['name'],
                            args['forest_host'],
                            connection=connection)
        if database.exists():
            print("Error: Database already exists: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Create database {0}...".format(args['name']))
        database.create()