jp (base): added exitCb generic callback to display a message and quit
This commit is contained in:
parent
1ae6d839ce
commit
d95aeb2bd3
1 changed files with 10 additions and 0 deletions
|
|
@ -779,6 +779,16 @@ class CommandBase(object):
|
||||||
raise exceptions.InternalError(_(u'trying to use output when use_output has not been set'))
|
raise exceptions.InternalError(_(u'trying to use output when use_output has not been set'))
|
||||||
return self.host.output(output_type, self.args.output, self.extra_outputs, data)
|
return self.host.output(output_type, self.args.output, self.extra_outputs, data)
|
||||||
|
|
||||||
|
def exitCb(self, msg=None):
|
||||||
|
"""generic callback for success
|
||||||
|
|
||||||
|
optionally print a message, and quit
|
||||||
|
msg(None, unicode): if not None, print this message
|
||||||
|
"""
|
||||||
|
if msg is not None:
|
||||||
|
self.disp(msg)
|
||||||
|
self.host.quit(C.EXIT_OK)
|
||||||
|
|
||||||
def errback(self, failure_, msg=None, exit_code=C.EXIT_ERROR):
|
def errback(self, failure_, msg=None, exit_code=C.EXIT_ERROR):
|
||||||
"""generic callback for errbacks
|
"""generic callback for errbacks
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue