Example #1
0
 def reload_configuration(self):
     self.configuration = configuration.try_load_file(self.configuration_filepath)
     if not self.configuration:
         raise Exception('Failed to load configuration from file: "%s"', self.configuration_filepath)
     self.configuration.timestamp = timestamper.from_seconds(os.stat(self.configuration_filepath).st_mtime)
     self.coordinator = self.configuration.coordinators[self.id]
     logging.debug('timestamp: %s', self.configuration.timestamp)
Example #2
0
def try_load_file(filepath, timestamp=None):
    try:
        if not timestamp:
            timestamp = timestamper.from_seconds(os.path.getmtime(filepath))
        with open(filepath) as f:
            representation = yaml.load(f)
    except OSError, e:
        logging.error('Failed reading configuration file: %s', e)
        return None