From: Ondrej Lichtner <olichtne(a)redhat.com>
The deconfigure action calls just the deconfiguration of slaves as
defined in the /tmp/.lnst_machine_conf file created by a previous
config_only run.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst-ctl | 7 +++++--
lnst/Controller/NetTestController.py | 5 +++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lnst-ctl b/lnst-ctl
index 80b1308..4ce280e 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -33,7 +33,7 @@ def usage(retval=0):
"""
print "Usage: %s [OPTIONS...] ACTION [RECIPES...]" % sys.argv[0]
print ""
- print "ACTION = [ run | config_only | match_setup ]"
+ print "ACTION = [ run | config_only | deconfigure | match_setup ]"
print ""
print "OPTIONS"
print " -a, --define-alias name=value define top-level alias"
@@ -200,9 +200,12 @@ def main():
action = args[0]
recipes = args[1:]
- if not action in ['run', 'config_only', 'match_setup']:
+ if not action in ['run', 'config_only', 'deconfigure',
'match_setup']:
logging.error("Action '%s' not recognised" % action)
usage(RETVAL_ERR)
+ if action == 'deconfigure':
+ NetTestController.remove_saved_machine_config()
+ return 0
summary = []
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index b2694c4..2a18b1b 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -56,7 +56,7 @@ class NetTestController:
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
- self._remove_saved_machine_config()
+ self.remove_saved_machine_config()
sp = SlavePool(lnst_config.get_option('environment',
'pool_dirs'),
check_process_running("libvirtd"), pool_checks)
@@ -446,7 +446,8 @@ class NetTestController:
with open("/tmp/.lnst_machine_conf", "wb") as f:
pickled_data = cPickle.dump(config_data, f)
- def _remove_saved_machine_config(self):
+ @classmethod
+ def remove_saved_machine_config(cls):
#removes previously saved configuration
cfg = None
try:
--
1.8.5.3
Show replies by date