diff options
author | Andy Grover <agrover@redhat.com> | 2014-01-08 12:42:15 -0800 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2014-01-08 12:42:15 -0800 |
commit | 636a57f928cdfaed5ba5022cf3139b20f53c02c4 (patch) | |
tree | fb822d72df41e9551ee5eb2a897d30f86262017f | |
parent | c48a8f59f1b053e41ba8af3bd6fa8ff93a716274 (diff) | |
download | rtslib-fb-636a57f928cdfaed5ba5022cf3139b20f53c02c4.tar.gz |
Make setup() err_funcs return more info from exceptions
Instead of just saying there was an error, also include the string text
from the RTSLibError exception.
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | rtslib/root.py | 4 | ||||
-rw-r--r-- | rtslib/target.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/rtslib/root.py b/rtslib/root.py index 03745ac..df2d41c 100644 --- a/rtslib/root.py +++ b/rtslib/root.py @@ -199,8 +199,8 @@ class RTSRoot(CFSNode): continue try: set_attributes(so_obj, so.get('attributes', {})) - except RTSLibError: - err_func("Could not set an attribute for %s" % so['name']) + except RTSLibError as e: + err_func("Could not set an attribute for %s: %s" % (so['name'], e)) # Don't need to create fabric modules for index, fm in enumerate(config.get('fabric_modules', [])): diff --git a/rtslib/target.py b/rtslib/target.py index 0b23b68..ef193d1 100644 --- a/rtslib/target.py +++ b/rtslib/target.py @@ -122,8 +122,8 @@ class Target(CFSNode): try: t_obj = Target(fm_obj, t['wwn']) - except RTSLibError: - err_func("Could not create Target object") + except RTSLibError as e: + err_func("Could not create Target object: %s" % e) return for tpg in t.get('tpgs', []): @@ -945,8 +945,8 @@ class NodeACL(CFSNode): return try: acl_obj = cls(tpg_obj, acl['node_wwn']) - except RTSLibError: - err_func("Error when creating NodeACL for %s" % acl['node_wwn']) + except RTSLibError as e: + err_func("Error when creating NodeACL for %s: %s" % (acl['node_wwn'], e)) return set_attributes(acl_obj, acl.get('attributes', {})) |