thiell/test — Issue #142: Exceptions tree improvements for NodeSet/NodeGroups
Author: thiell
Created: 2012-03-03 16:34:40+00:00
State: open
Labels: Lib/NodeSet

The non-trivial design between modules NodeUtils and NodeSet has lead to complex, possibly unneeded error exceptions tree for node groups support. This ticket is here to track improvements about these exceptions that could be done for version 2.
These are the exception catchers in the scripts ({{{clush}}}, {{{clubak}}}, {{{nodeset}}}) for version 1.3:

{{{
#!python
except NodeSetExternalError, e:
print >> sys.stderr, "clush: external error:", e
sys.exit(1)
except NodeSetParseError, e:
print >> sys.stderr, "clush: parse error:", e
sys.exit(1)
except GroupResolverSourceError, e:
print >> sys.stderr, "ERROR: unknown group source: \\"%s\\"" % e
sys.exit(1)
except GroupSourceNoUpcall, e:
print >> sys.stderr, "ERROR: no %s upcall defined for group " \\
"source \\"%s\\"" % (e, e.group_source.name)
sys.exit(1)
except GroupSourceException, e:
print >> sys.stderr, "ERROR: other group error:", e
sys.exit(1)
}}}

A simple improvement could be to avoid !GroupSource* and !GroupResolver* exceptions at the user level, wrapping them by !NodeSetExternalError. This should be discussed, possibly redesigned and reimplemented.