Exemplo n.º 1
0
def write_game_config(game_slug, config):
    """Writes a game config to disk"""
    configpath = make_game_config_id(game_slug)
    logger.debug("Writing game config to %s", configpath)
    config_filename = os.path.join(settings.CONFIG_DIR,
                                   "games/%s.yml" % configpath)
    write_yaml_to_file(config, config_filename)
    return configpath
Exemplo n.º 2
0
 def save(self):
     """Save configuration file according to its type"""
     # logger.debug("Saving config %s", self.__repr__())
     if self.level == "system":
         config = self.system_level
         config_path = self.system_config_path
     elif self.level == "runner":
         config = self.runner_level
         config_path = self.runner_config_path
     elif self.level == "game":
         config = self.game_level
         config_path = self.game_config_path
     else:
         raise ValueError("Invalid config level '%s'" % self.level)
     write_yaml_to_file(config_path, config)
     self.update_cascaded_config()
Exemplo n.º 3
0
    def save(self):
        """Save configuration file according to its type"""
        if self.level == "system":
            config = self.system_level
            config_path = self.system_config_path
        elif self.level == "runner":
            config = self.runner_level
            config_path = self.runner_config_path
        elif self.level == "game":
            config = self.game_level
            config_path = self.game_config_path
        else:
            raise ValueError("Invalid config level '%s'" % self.level)

        logger.debug("Saving %s config to %s", self, config_path)
        write_yaml_to_file(config_path, config)
        self.initialize_config()