summaryrefslogtreecommitdiffstats
path: root/cobbler/api.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-05-05 11:13:16 -0400
committerJim Meyering <jim@meyering.net>2006-05-05 11:13:16 -0400
commit9aef401e5787d9c00424dbdfceb577aa9ce1f012 (patch)
treefcc122acbccbe42a5a1d7ea79eec8e3c24e178c2 /cobbler/api.py
parenta5ffe9dda2488240d3fa440a11b2a88267110031 (diff)
downloadthird_party-cobbler-9aef401e5787d9c00424dbdfceb577aa9ce1f012.tar.gz
third_party-cobbler-9aef401e5787d9c00424dbdfceb577aa9ce1f012.tar.xz
third_party-cobbler-9aef401e5787d9c00424dbdfceb577aa9ce1f012.zip
Make /etc/cobbler.conf be packaged instead of being created, proper handling of parse errors on config files, tweaking unit tests tempfile stuff since sync() test is currently broken by the tempfile changes (why??)
Diffstat (limited to 'cobbler/api.py')
-rw-r--r--cobbler/api.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/cobbler/api.py b/cobbler/api.py
index 77dd835..e48fe7a 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -29,13 +29,19 @@ class BootAPI:
try:
if self.config.files_exist():
self.config.deserialize()
- except:
- # traceback.print_exc()
- print m("no_cfg")
+ except Exception, e:
+ # parse errors, attempt to recover
+ print self.last_error
+ if self.last_error == m("parse_error"):
+ # the error came from /etc/cobbler.conf, and must be fixed
+ # manually, CLI can't do it for policy reasons on /etc
+ raise Exception, "parse_error"
try:
self.config.serialize()
except:
+ # shouldn't get here. File permissions issue, perhaps?
traceback.print_exc()
+ raise Exception, "parse_error2"
if not self.config.files_exist():
self.config.serialize()