From ebd5a21f7308b75785a660aa7afbfe8a5ab292e7 Mon Sep 17 00:00:00 2001 From: Nekmo Date: Mon, 15 Oct 2018 01:45:53 +0200 Subject: [PATCH] Issue #93: Use THEN to execute (load templates and devices) --- amazon_dash/config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/amazon_dash/config.py b/amazon_dash/config.py index 19703d2..1fbcf95 100644 --- a/amazon_dash/config.py +++ b/amazon_dash/config.py @@ -5,7 +5,10 @@ from pwd import getpwuid from jsonschema import validate, ValidationError + +from then.configs.base import LoadConfig from then.configs.components import LoadComponentConfigs +from then.configs.templates import LoadTemplates from then.helper import Then from yaml import load from yaml.error import YAMLError @@ -201,7 +204,8 @@ def only_root_write(path): class Config: """Parse and validate yaml Amazon-dash file config. The instance behaves like a dictionary """ - then = None + templates = None + devices = None def __init__(self, file, ignore_perms=False, **kwargs): """Set the config file and validate file permissions @@ -230,7 +234,9 @@ def read(self): :return: None """ - self.then = Then(LoadComponentConfigs(self.file, section='actions')) + then = Then(LoadComponentConfigs(self.file, section='actions')) + self.templates = then.templates(LoadTemplates(self.file)) + self.devices = LoadConfig(self.file, 'devices') pass # try: # data = load(open(self.file), Loader)