summaryrefslogtreecommitdiffstats
path: root/cobbler/item_system.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-05-08 18:34:42 -0400
committerJim Meyering <jim@meyering.net>2006-05-08 18:34:42 -0400
commit804a564ac24ff22cd46583fa98d8140a8b10f476 (patch)
treefadba99af49b4da97be1a5b7ab7af42cb780db39 /cobbler/item_system.py
parentd4f71b4318fedf374844030095c6c8dd544f0e92 (diff)
downloadthird_party-cobbler-804a564ac24ff22cd46583fa98d8140a8b10f476.tar.gz
third_party-cobbler-804a564ac24ff22cd46583fa98d8140a8b10f476.tar.xz
third_party-cobbler-804a564ac24ff22cd46583fa98d8140a8b10f476.zip
Adding exception handling to remove the problem of propogating error codes all the way up the stack. Still not quite super-consistant, but getting there. Util functions still return true/false since they just ask questions, but API functions will throw errors to ensure they are being dealt with. Main CLI class needs to take advantage of this fact and become simpler. Tests are already modified to detect new exceptions with one exception :)
Diffstat (limited to 'cobbler/item_system.py')
-rw-r--r--cobbler/item_system.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index fef3743..4607623 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -6,7 +6,7 @@ Michael DeHaan <mdehaan@redhat.com>
import utils
import item
-from cobbler_exception import CobblerException
+import cexceptions
class System(item.Item):
@@ -33,7 +33,7 @@ class System(item.Item):
"""
new_name = utils.find_system_identifier(name)
if not new_name:
- raise CobblerException("bad_sys_name")
+ raise cexceptions.CobblerException("bad_sys_name")
self.name = name # we check it add time, but store the original value.
return True
@@ -45,14 +45,14 @@ class System(item.Item):
if self.config.profiles().find(profile_name):
self.profile = profile_name
return True
- return False
+ raise cexceptions.CobblerException("exc_profile")
def is_valid(self):
"""
A system is valid when it contains a valid name and a profile.
"""
if self.name is None:
- raise CobblerException("bad_sys_name")
+ return False
if self.profile is None:
return False
return True