Skeleton and sensors works
diff --git a/wally/config.py b/wally/config.py
index e96a03e..46669f0 100644
--- a/wally/config.py
+++ b/wally/config.py
@@ -1,30 +1,45 @@
-from typing import Any, Dict
+from typing import Any, Dict, Optional
from .storage import IStorable
-ConfigBlock = Dict[str, Any]
+ConfigBlock = Any
class Config(IStorable):
- # make mypy happy
- run_uuid = None # type: str
- storage_url = None # type: str
- comment = None # type: str
- keep_vm = None # type: bool
- dont_discover_nodes = None # type: bool
- build_id = None # type: str
- build_description = None # type: str
- build_type = None # type: str
- default_test_local_folder = None # type: str
- settings_dir = None # type: str
- connect_timeout = 30 # type: int
- no_tests = False # type: bool
-
def __init__(self, dct: ConfigBlock) -> None:
- self.__dict__['_dct'] = dct
+ # make mypy happy, set fake dict
+ self.__dict__['_dct'] = {}
+ self.run_uuid = None # type: str
+ self.storage_url = None # type: str
+ self.comment = None # type: str
+ self.keep_vm = None # type: bool
+ self.dont_discover_nodes = None # type: bool
+ self.build_id = None # type: str
+ self.build_description = None # type: str
+ self.build_type = None # type: str
+ self.default_test_local_folder = None # type: str
+ self.settings_dir = None # type: str
+ self.connect_timeout = None # type: int
+ self.no_tests = False # type: bool
+ self.debug_agents = False # type: bool
+
+ # None, disabled, enabled, metadata, ignore_errors
+ self.discovery = None # type: Optional[str]
+
+ self.logging = None # type: ConfigBlock
+ self.ceph = None # type: ConfigBlock
+ self.openstack = None # type: ConfigBlock
+ self.fuel = None # type: ConfigBlock
+ self.test = None # type: ConfigBlock
+ self.sensors = None # type: ConfigBlock
+
+ self._dct.clear()
+ self._dct.update(dct)
+
+ def raw(self) -> ConfigBlock:
+ return self._dct
def get(self, path: str, default: Any = None) -> Any:
curr = self
-
while path:
if '/' in path:
name, path = path.split('/', 1)
@@ -41,7 +56,7 @@
def __getattr__(self, name: str) -> Any:
try:
- val = self.__dct[name]
+ val = self._dct[name]
except KeyError:
raise AttributeError(name)
@@ -51,7 +66,7 @@
return val
def __setattr__(self, name: str, val: Any):
- self.__dct[name] = val
+ self._dct[name] = val
def __contains__(self, name: str) -> bool:
return self.get(name) is not None