6
class LayerOptions(dict):
7
def __init__(self, layer_file, section=None):
8
with open(layer_file) as f:
9
layer = yaml.safe_load(f.read())
10
opts = layer.get('options', {})
11
if section and section in opts:
12
super(LayerOptions, self).__init__(opts.get(section))
14
super(LayerOptions, self).__init__(opts)
17
def options(section=None, layer_file=None):
19
base_dir = os.environ.get('CHARM_DIR', os.getcwd())
20
layer_file = os.path.join(base_dir, 'layer.yaml')
22
return LayerOptions(layer_file, section)