patch for swup configuration error reporting
Jaakko Heinonen <[email protected]> Wed, 17 Mar 2004 09:00:49 +0200
| Newsgroups | gmane.linux.trustix.swup |
|---|---|
| Message-ID | <[email protected]> |
Problem:
I had an swup configuration file without "class = 0" sites.
$ swup --config-file /tmp/myswup.cf --upgrade
Traceback (most recent call last):
File "/usr/bin/swup", line 33, in ?
retval = runswup(sys.argv[1:])
File "/usr/bin/swup", line 23, in runswup
retval = swup.main( args )
File "/usr/lib/swup/swup.py", line 355, in main
sys.stderr.write('%s\n' % errmsg)
TypeError: __str__ returned non-string (type instance)
Here's a patch which cures the proble:
diff -urN swup-0.0.20040317.orig/swup/swup.py swup-0.0.20040317/swup/swup.py
--- swup-0.0.20040317.orig/swup/swup.py 2004-03-04 18:07:42.000000000 +0200
+++ swup-0.0.20040317/swup/swup.py 2004-03-17 08:51:05.000000000 +0200
@@ -169,9 +169,9 @@
except config.ConfigIOError, e:
raise SetupException, 'Unable to open config file: %s' % e
except config.ConfigNoNullClassFoundError, e:
- raise SetupException, e
+ raise SetupException, str(e)
except config.ConfigNoSiteFoundError, e:
- raise SetupException, e
+ raise SetupException, str(e)
except config.ConfigParseError, message:
raise SetupException, '%s\n%s' % \
('Error in config file %s.' % config_file,
diff -urN swup-0.0.20040317.orig/swuplib/config.py swup-0.0.20040317/swuplib/config.py
--- swup-0.0.20040317.orig/swuplib/config.py 2004-02-20 20:01:03.000000000 +0200
+++ swup-0.0.20040317/swuplib/config.py 2004-03-17 08:50:31.000000000 +0200
@@ -354,7 +354,7 @@
sys.stdout.write( "Warning: %s\n" %errmsg)
config["sites"] = sitelist
else:
- raise ConfigNoSiteFound()
+ raise ConfigNoSiteFoundError()
# check uid != 0
if os.getuid() != 0:
After applying this patch swup gives:
$ swup --config-file /tmp/myswup.cf --upgrade
Error: No site configured with 'class = 0' found.
--
Jaakko