Ejemplo n.º 1
0
    def execute(action_id, session, unit, token, args={}):
        environment = actions_db.get_environment(session, unit)
        action = ActionServices.find_action(session.description, action_id)
        if action is None:
            raise LookupError('Action is not found')
        if not action[1].get('enabled', True):
            raise ValueError('Cannot execute disabled action')

        ActionServices.submit_task(action[1]['name'], action[0],
                                   args, environment, session, token, unit)
Ejemplo n.º 2
0
    def execute(action_id, session, unit, token, args={}):
        environment = actions_db.get_environment(session, unit)
        action = ActionServices.find_action(session.description, action_id)
        if action is None:
            raise LookupError('Action is not found')
        if not action[1].get('enabled', True):
            raise ValueError('Cannot execute disabled action')

        return ActionServices.submit_task(action[1]['name'], action[0], args,
                                          environment, session, token, unit)