Exemple #1
0
def _proc_evt_abort(cmd, args):
    """Abort TARGETS of given type.

    If TARGETS are not given, aborts current task/recipe/recipeset as specified
    by environment."""
    global abort_opts
    cmd = cmd.lower()
    abort_type = cmd[len('abort'):]
    if abort_type.startswith('_'):
        abort_type = abort_type[1:]
    abort_type = {'r':'recipe', 'rs':'recipeset', 't':'task'}.get(abort_type, abort_type)
    if not abort_opts:
        abort_opts = OptionParser(usage="%prog [OPTIONS] [TARGETS]",
                description="Return a %prog result.")
        abort_opts.disable_interspersed_args()
        abort_opts.add_option("-m", "--message", action="store",
                dest="message", help="message to log", type="string",
                default="")
    abort_opts.prog = cmd
    opts, args = abort_opts.parse_args(args)
    if args:
        targets = args
    else:
        abort_env = {'task':'TASKID', 'recipe':'RECIPEID', 'recipeset':'RECIPESET'}[abort_type]
        target = os.getenv(abort_env)
        if target:
            targets = [target]
        else:
            targets = []
    evts = []
    for target in targets:
        evts.append(event.abort(abort_type, target=target, message=opts.message))
    return evts
Exemple #2
0
def _proc_evt_abort(cmd, args):
    """Abort TARGETS of given type.

    If TARGETS are not given, aborts current task/recipe/recipeset as specified
    by environment."""
    global abort_opts
    cmd = cmd.lower()
    abort_type = cmd[len('abort'):]
    if abort_type.startswith('_'):
        abort_type = abort_type[1:]
    abort_type = {
        'r': 'recipe',
        'rs': 'recipeset',
        't': 'task'
    }.get(abort_type, abort_type)
    if not abort_opts:
        abort_opts = OptionParser(usage="%prog [OPTIONS] [TARGETS]",
                                  description="Return a %prog result.")
        abort_opts.disable_interspersed_args()
        abort_opts.add_option("-m",
                              "--message",
                              action="store",
                              dest="message",
                              help="message to log",
                              type="string",
                              default="")
    abort_opts.prog = cmd
    opts, args = abort_opts.parse_args(args)
    if args:
        targets = args
    else:
        abort_env = {
            'task': 'TASKID',
            'recipe': 'RECIPEID',
            'recipeset': 'RECIPESET'
        }[abort_type]
        target = os.getenv(abort_env)
        if target:
            targets = [target]
        else:
            targets = []
    evts = []
    for target in targets:
        evts.append(
            event.abort(abort_type, target=target, message=opts.message))
    return evts
Exemple #3
0
 def xmlrpc_abortRecipe(self, recipe_id):
     log.debug("XMLRPC: watchdog.abortRecipe(%r)", recipe_id)
     # FIXME!!! check this!
     self.main.send_evt(event.abort('recipe', target=recipe_id))
     return 0  # or "Failure reason"
Exemple #4
0
 def xmlrpc_abortJob(self, job_id):
     log.debug("XMLRPC: watchdog.abortJob(%r)", job_id)
     # FIXME!!! check this!
     self.main.send_evt(event.abort('job', target=job_id))
     return 0  # or "Failure reason"
Exemple #5
0
 def xmlrpc_abortRecipe(self, recipe_id):
     log.debug("XMLRPC: watchdog.abortRecipe(%r)", recipe_id)
     # FIXME!!! check this!
     self.main.send_evt(event.abort('recipe', target=recipe_id))
     return 0 # or "Failure reason"
Exemple #6
0
 def xmlrpc_abortJob(self, job_id):
     log.debug("XMLRPC: watchdog.abortJob(%r)", job_id)
     # FIXME!!! check this!
     self.main.send_evt(event.abort('job', target=job_id))
     return 0 # or "Failure reason"