def readConfigurationFile(filename, allowTermination = True): try: jsonData = open(filename) except: # TODO ERROR if allowTermination: errors.fileErrors().noFile(filename) else: return False try: data = json.load(jsonData) except: if allowTermination: errors.fileErrors().notJson(filename, sys.exc_info) else: return False return data
def __init__(self, toolsPath, pipelinesPath, definedPath): # Define error handling for file errors. self.errors = errors.fileErrors() # If a path to configuration files was defined by the used, find the available configuration # files in this directory. self.userConfigurationFiles = self.getValidJsonFiles(os.listdir(definedPath)) if definedPath else [] # Get the names of all available tools and pipelines. self.pipelines = self.getValidJsonFiles(os.listdir(pipelinesPath)) self.tools = self.getValidJsonFiles(os.listdir(toolsPath))