s4:samba-tool/testparm: report a CommandError if loading of the config file fails
authorStefan Metzmacher <metze@samba.org>
Fri, 9 Nov 2012 08:01:29 +0000 (09:01 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 26 Nov 2012 11:37:39 +0000 (12:37 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 11f5d54cbb10fd5c5f0e1718427609709c3476f4)

Fix bug #9373 - Output of 'samba-tool' does not look very nice.

source4/scripting/python/samba/netcmd/testparm.py

index 34c8fa50fcb6afb17e204f235929511d76535903..92514694218a4b46b8dca9cc40303638cfbbfcea 100644 (file)
@@ -82,7 +82,10 @@ class cmd_testparm(Command):
             raise CommandError("Both a DNS name and an IP address are "
                                "required for the host access check")
 
-        lp = sambaopts.get_loadparm()
+        try:
+            lp = sambaopts.get_loadparm()
+        except RuntimeError, err:
+            raise CommandError(err)
 
         # We need this to force the output
         samba.set_debug_level(2)