commit cca79f00a475bb4c73f9e48790a3c4f761dc458b
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Nov 9 14:48:39 2012 +0100
nettestctl: create user config file at first launch
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 files changed, 9 insertions(+), 1 deletions(-)
---
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
Show replies by date