From: Ondrej Lichtner olichtne@redhat.com
Defines the SlaveConfig class. This is part of an effort to move from a single global lnst_config object to using a non-global config object, that uses a different scheme for Controller and Slave.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Slave/Config.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 lnst/Slave/Config.py
diff --git a/lnst/Slave/Config.py b/lnst/Slave/Config.py new file mode 100644 index 0000000..e749528 --- /dev/null +++ b/lnst/Slave/Config.py @@ -0,0 +1,73 @@ +""" +Defines the SlaveConfig class. + +Copyright 2017 Red Hat, Inc. +Licensed under the GNU General Public License, version 2 as +published by the Free Software Foundation; see COPYING for details. +""" + +__author__ = """ +olichtne@redhat.com (Ondrej Lichtner) +""" + +import os +import sys +from lnst.Common.Config import DefaultRPCPort, Config + +class SlaveConfig(Config): + def _init_options(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()