From: Ondrej Lichtner <olichtne(a)redhat.com>
The controller detets its first launch by searching for a configuration
file in the users home directory. If it doesn't exist it creates it and
fills it with values that are currently loaded. Using this configuration
file is not yet fully functional as it requires the correct values to be
loaded from the system-wide configuration file /etc/lnst-ctl.conf which
will be added at a later date.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
nettestctl.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/nettestctl.py b/nettestctl.py
index e97733c..416e0ab 100755
--- a/nettestctl.py
+++ b/nettestctl.py
@@ -106,7 +106,15 @@ def main():
config.load_config(gitcfg)
else:
config.load_config('/etc/lnst-ctl.conf')
- config.load_config('~/.lnst/lnst-ctl.conf')
+ usr_cfg = os.path.expanduser('~/.lnst/lnst-ctl.conf')
+ if os.path.isfile(usr_cfg):
+ config.load_config(usr_cfg)
+ else:
+ if not os.path.isdir(os.path.dirname(usr_cfg)):
+ os.makedirs(os.path.dirname(usr_cfg))
+ with open(usr_cfg, 'w') as f:
+ f.write(config.dump_config())
+
debug = 0
recipe_path = None
--
1.7.11.7