def forest(self, forest_name, host=None, connection=None): """ Get the named forest. """ if host is None: if connection is None: db = Forest(forest_name, connection=self.connection, save_connection=self.save_connection) else: db = Forest(forest_name, connection=connection, save_connection=False) else: if connection is None: db = Forest(forest_name, host.host_name(), connection=self.connection, save_connection=self.save_connection) else: db = Forest(forest_name, host.host_name(), connection=connection, save_connection=False) if connection is None: return db.read(self.connection) else: return db.read(connection)
def get(self, args, config, connection): forest = Forest(args['name'], connection=connection) if not forest.exists(): print("Error: Forest does not exist: {0}".format(args['name'])) sys.exit(1) forest.read() self.jprint(forest)