def getConfig(self): """ Returns the project's config or raises an exception if none. """ config_json = self.getConfigJSON() # Parse the project's configuration and save it. try: self.config = Configuration.parse(config_json) except ConfigParseException as cpe: fail('Error parsing gantry config', project = self.project_name, exception = cpe) except Exception as e: self.logger.exception(e) return self.config
def loadConfig(config_file): """ Attempts to load and parse the given config file. """ try: with open(config_file, 'r') as f: config_json = f.read() except: print 'Could not find config file: ' + config_file return None try: return Configuration.parse(config_json) except Exception as e: print 'Error parsing gantry config: ' + str(e) return None
def getConfig(self): """ Returns the project's config or raises an exception if none. """ config_json = self.getConfigJSON() # Parse the project's configuration and save it. try: self.config = Configuration.parse(config_json) except ConfigParseException as cpe: fail('Error parsing gantry config', project=self.project_name, exception=cpe) except Exception as e: self.logger.exception(e) return self.config