Ejemplo n.º 1
0
 def run(cls, c):
     if c.input_res and not isinstance(c.input_res, dict):
         raise exceptions.CommandException('{0} needs a mapping as input!'.format(c.comm_type))
     if c.comm_type == 'ask_password':
         res = DialogHelper.ask_for_password(**c.input_res)
     elif c.comm_type == 'ask_confirm':
         res = DialogHelper.ask_for_confirm_with_message(**c.input_res)
     elif c.comm_type == 'ask_input':
         res = DialogHelper.ask_for_input_with_prompt(**c.input_res)
     else:
         raise exceptions.CommandException('Unknown command type {ct}.'.format(ct=c.comm_type))
     return bool(res), res