Exemplo n.º 1
0
    def _get_file_and_new_contents(self, key):
        filename = self.manifest.get(key)
        contents = None
        if filename and os.path.exists(filename):
            return os.path.join(self.cachedir, filename), None

        fileroot = self._key_to_file(key)
        filename = os.path.join(self.cachedir, fileroot)
        with open(filename, 'wb') as f:
            contents = self._get_file_contents(key)
            f.write(contents)

        self.manifest[key] = fileroot
        Yaml.write(self.manifest_file, self.manifest)
        return filename, contents
Exemplo n.º 2
0
    def _get_file_and_new_contents(self, key):
        filename = self.manifest.get(key)
        contents = None
        if filename and os.path.exists(filename):
            return os.path.join(self.cachedir, filename), None

        fileroot = self._key_to_file(key)
        filename = os.path.join(self.cachedir, fileroot)
        with open(filename, 'wb') as f:
            contents = self._get_file_contents(key)
            f.write(contents)

        self.manifest[key] = fileroot
        Yaml.write(self.manifest_file, self.manifest)
        return filename, contents
Exemplo n.º 3
0
def config(_, scope, cfg):
  f = CommandFile.config_file(scope)
  configs = Yaml.read(f) + [cfg]
  Yaml.write(f, Merge.merge(*configs))
  # TODO: needs to propagate!
  LOGGER.info('Changing configuration for %s', scope)
Exemplo n.º 4
0
def settings(_, scope, cfg):
    f = DataFile.settings_file(scope)
    settings = Yaml.read(f) + [cfg]
    Yaml.write(f, Merge.merge(*settings))
    # TODO: needs to propagate!
    LOGGER.info('Changing settings for %s', scope)
Exemplo n.º 5
0
 def _write(self):
     Yaml.write(self._filename, self)
Exemplo n.º 6
0
 def _write(self):
   Yaml.write(self._filename, self)
Exemplo n.º 7
0
def settings(_, scope, cfg):
    f = DataFile.settings_file(scope)
    settings = Yaml.read(f) + [cfg]
    Yaml.write(f, Merge.merge(*settings))
    # TODO: needs to propagate!
    LOGGER.info('Changing settings for %s', scope)