def setConfig(self, config): """ Sets the project's config in etcd. """ config_json = json.dumps(config) self.logger.debug('Updating configuration for project %s', self.project_name) self.etcd_client.set(getProjectConfigPath(self.project_name), config_json)
def getConfigJSON(self): """ Returns the project's config JSON or raises an exception if none. """ # Lookup the project on etcd. If none, report an error. config_json = None try: self.logger.debug('Looking up configuration for project %s in etcd', self.project_name) config_json = self.etcd_client.get(getProjectConfigPath(self.project_name)).value except KeyError as k: self.logger.exception(k) fail('Unknown project ' + self.project_name, project = self.project_name) return config_json
def getConfigJSON(self): """ Returns the project's config JSON or raises an exception if none. """ # Lookup the project on etcd. If none, report an error. config_json = None try: self.logger.debug( 'Looking up configuration for project %s in etcd', self.project_name) config_json = self.etcd_client.get( getProjectConfigPath(self.project_name)).value except KeyError as k: self.logger.exception(k) fail('Unknown project ' + self.project_name, project=self.project_name) return config_json