From: Ondrej Lichtner <olichtne(a)redhat.com>
The schema initialization methods were moved into Slave and Controller
specific Config classes so they're not needed in the base Config class
anymore.
In addition this adds an _init_options call to the __init__ method which
ensures that the schema will be created on object creation.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/Config.py | 143 ++------------------------------------------------
1 file changed, 4 insertions(+), 139 deletions(-)
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index 04d6f9b..afeab42 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -32,6 +32,10 @@ class Config():
def __init__(self):
self._options = dict()
self.version = self._get_version()
+ self._init_options()
+
+ def _init_options(self):
+ raise NotImplementedError()
def _get_version(self):
# Check if I'm in git
@@ -56,145 +60,6 @@ class Config():
os.chdir(cwd)
return version
- def controller_init(self):
- self._options['environment'] = dict()
- self._options['environment']['mac_pool_range'] = {\
- "value" : ['52:54:01:00:00:01',
'52:54:01:FF:FF:FF'],
- "additive" : False,
- "action" : self.optionMacRange,
- "name" : "mac_pool_range"}
- self._options['environment']['rpcport'] = {\
- "value" : DefaultRPCPort,
- "additive" : False,
- "action" : self.optionPort,
- "name" : "rpcport"}
- self._options['environment']['tool_dirs'] = {\
- "value" : [],
- "additive" : True,
- "action" : self.optionDirList,
- "name" : "test_tool_dirs"}
- self._options['environment']['module_dirs'] = {\
- "value" : [],
- "additive" : True,
- "action" : self.optionDirList,
- "name" : "test_module_dirs"}
- self._options['environment']['log_dir'] = {\
- "value" : os.path.abspath(os.path.join(
- os.path.dirname(sys.argv[0]), './Logs')),
- "additive" : False,
- "action" : self.optionPath,
- "name" : "log_dir"}
- self._options['environment']['resource_dir'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPath,
- "name" : "resource_dir"}
- self._options['environment']['xslt_url'] = {
- "value" :
"http://www.lnst-project.org/files/result_xslt/xml_to_html.xsl",
- "additive" : False,
- "action" : self.optionPlain,
- "name" : "xslt_url"
- }
- self._options['environment']['allow_virtual'] = {
- "value" : False,
- "additive" : False,
- "action" : self.optionBool,
- "name" : "allow_virtual"
- }
-
- self._options['perfrepo'] = dict()
- self._options['perfrepo']['url'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPlain,
- "name" : "url"
- }
- self._options['perfrepo']['username'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPlain,
- "name" : "username"
- }
- self._options['perfrepo']['password'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPlain,
- "name" : "password"
- }
-
- self._options['pools'] = dict()
-
- self._options['security'] = dict()
- self._options['security']['identity'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPlain,
- "name" : "identity"}
- self._options['security']['privkey'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPath,
- "name" : "privkey"}
-
- self.colours_scheme()
-
- def slave_init(self):
- self._options['environment'] = dict()
- self._options['environment']['log_dir'] = {\
- "value" : os.path.abspath(os.path.join(
- os.path.dirname(sys.argv[0]), './Logs')),
- "additive" : False,
- "action" : self.optionPath,
- "name" : "log_dir"}
- self._options['environment']['use_nm'] = {\
- "value" : True,
- "additive" : False,
- "action" : self.optionBool,
- "name" : "use_nm"}
- self._options['environment']['rpcport'] = {\
- "value" : DefaultRPCPort,
- "additive" : False,
- "action" : self.optionPort,
- "name" : "rpcport"}
-
- self._options['cache'] = dict()
- self._options['cache']['dir'] = {\
- "value" : os.path.abspath(os.path.join(
- os.path.dirname(sys.argv[0]), './cache')),
- "additive" : False,
- "action" : self.optionPath,
- "name" : "cache_dir"}
-
- self._options['cache']['expiration_period'] = {\
- "value" : 7*24*60*60, # 1 week
- "additive" : False,
- "action" : self.optionTimeval,
- "name" : "expiration_period"}
-
- self._options['security'] = dict()
- self._options['security']['auth_types'] = {\
- "value" : "none",
- "additive" : False,
- "action" : self.optionPlain, #TODO list??
- "name" : "auth_types"}
- self._options['security']['auth_password'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPlain,
- "name" : "auth_password"}
- self._options['security']['privkey'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPath,
- "name" : "privkey"}
- self._options['security']['ctl_pubkeys'] = {\
- "value" : "",
- "additive" : False,
- "action" : self.optionPath,
- "name" : "ctl_pubkeys"}
-
- self.colours_scheme()
-
def colours_scheme(self):
self._options['colours'] = dict()
self._options['colours']["disable_colours"] = {\
--
2.13.0