コード例 #1
0
 def test_rget(self):
     c = ComposerConfig()
     c['a'] = 1
     c = c.new_child()
     c['a'] = 99
     c['b'] = "alpha"
     self.assertEqual(c.get('a'), 99)
     self.assertEqual(c.get('b'), "alpha")
     self.assertEqual(c.rget('a'), [99, 1])
コード例 #2
0
ファイル: __init__.py プロジェクト: chuckbutler/juju-compose
class Configable(object):
    CONFIG_FILE = None

    def __init__(self):
        self._config = ComposerConfig()
        self.config_file = None

    @property
    def config(self):
        if self._config.configured:
            return self._config
        if self.config_file and self.config_file.exists():
            self._config.configure(self.config_file)
        return self._config

    @property
    def configured(self):
        return bool(self.config is not None and self.config.configured)
コード例 #3
0
ファイル: __init__.py プロジェクト: chuckbutler/juju-compose
    def plan_layers(self, layers, output_files):
        config = ComposerConfig()
        config = config.add_config(
            layers["layers"][0] / ComposerConfig.DEFAULT_FILE, True)

        for i, layer in enumerate(layers["layers"]):
            log.info("Processing layer: %s", layer.url)
            if i + 1 < len(layers["layers"]):
                next_layer = layers["layers"][i + 1]
                config = config.add_config(
                    next_layer / ComposerConfig.DEFAULT_FILE, True)
            list(e for e in utils.walk(layer.directory,
                                       self.build_tactics,
                                       current=layer,
                                       config=config,
                                       output_files=output_files))
        plan = [t for t in output_files.values() if t]
        return plan
コード例 #4
0
 def test_tactics(self):
     # configure from empty and a layer with tactics
     c = ComposerConfig()
     c._tactics = ['a', 'b', 'c']
     c = c.new_child()
     c._tactics = ['d', 'c']
     self.assertEqual(c.tactics()[:5], ['d', 'c', 'a', 'b', 'c'])
コード例 #5
0
ファイル: __init__.py プロジェクト: chuckbutler/juju-compose
 def __init__(self):
     self._config = ComposerConfig()
     self.config_file = None