Switch to use upstreamed LayerOptions implementation #1

Merged
merged 1 commit into from Jan 12, 2016
Jump to file or symbol
Failed to load files and symbols.
+2 −30
Split
View
@@ -1,6 +1,6 @@
from jujubigdata.utils import DistConfig
-from charms.layer import LayerOptions
+from charms import layer
def get_dist_config():
- return DistConfig(data=LayerOptions('hadoop-client'))
+ return DistConfig(data=layer.options('hadoop-client'))
View
@@ -1,28 +0,0 @@
-import yaml
-
-
-class LayerOptions(dict):
- """
- Container for layer-specific options.
-
- Each layer can define options that it accepts in its ``layer.yaml`` file.
- These definitions are provided in [jsonschema](http://json-schema.org/)
- format, which is the same format that Juju Action parameters are defined.
-
- Each layer can then also set option values that other layers have defined.
- The option values are validated at charm build time, and are made available
- to the charm via this class as a dictionary.
- """
- def __init__(self, layer_name):
- """
- Load layer-specific options from ``layer.yaml``.
-
- If the ``options`` section is not available in ``layer.yaml``, it
- falls back to a separate YAML file based on the `layer_name`.
-
- :param str layer_name: The name of the layer whose options we want.
- """
- super(LayerOptions, self).__init__()
- with open('layer.yaml') as fp:
- layer_yaml = yaml.safe_load(fp)
- self.update(layer_yaml.get('options', {}).get(layer_name, {}))