async def verify_parent_task(chain, link):
    """Verify the parent task Link.

    Action task verification is currently in the same verification function as
    decision tasks, because sometimes we'll have an action task masquerading as
    a decision task, e.g. in templatized actions for release graphs. To make
    sure our guess of decision or action task isn't fatal, we call this
    function; this function uses ``is_action()`` to determine how to verify
    the task.

    Args:
        chain (ChainOfTrust): the chain we're operating on.
        link (LinkOfTrust): the task link we're checking.

    Raises:
        CoTError: on chain of trust verification error.

    """
    worker_type = get_worker_type(link.task)
    if worker_type not in chain.context.config['valid_decision_worker_types']:
        raise CoTError("{} is not a valid decision workerType!".format(worker_type))
    if chain is not link:
        # make sure all tasks generated from this parent task match the published
        # task-graph.json. Not applicable if this link is the ChainOfTrust object,
        # since this task won't have generated a task-graph.json yet.
        path = link.get_artifact_full_path('public/task-graph.json')
        if not os.path.exists(path):
            raise CoTError("{} {}: {} doesn't exist!".format(link.name, link.task_id, path))
        link.task_graph = load_json_or_yaml(
            path, is_path=True, exception=CoTError, message="Can't load {}! %(exc)s".format(path)
        )
        # This check may want to move to a per-task check?
        for target_link in chain.get_all_links_in_chain():
            # Verify the target's task is in the parent task's task graph, unless
            # it's this task or a parent task.
            # (Decision tasks will not exist in a parent task's task-graph.json;
            #  action tasks, which are generated later, will also be missing.)
            # https://github.com/mozilla-releng/scriptworker/issues/77
            if target_link.parent_task_id == link.task_id and \
                    target_link.task_id != link.task_id and \
                    target_link.task_type not in PARENT_TASK_TYPES:
                verify_link_in_task_graph(chain, link, target_link)
    try:
        await verify_parent_task_definition(chain, link)
    except (BaseDownloadError, KeyError) as e:
        raise CoTError(e)
async def verify_parent_task ( chain , link ) : worker_type = get_worker_type ( link . task ) if worker_type not in chain . context . config [ 'valid_decision_worker_types' ] : raise CoTError ( "{} is not a valid decision workerType!" . format ( worker_type ) ) if chain is not link : path = link . get_artifact_full_path ( 'public/task-graph.json' ) if not os . path . exists ( path ) : raise CoTError ( "{} {}: {} doesn't exist!" . format ( link . name , link . task_id , path ) ) link . task_graph = load_json_or_yaml ( path , is_path = True , exception = CoTError , message = "Can't load {}! %(exc)s" . format ( path ) ) for target_link in chain . get_all_links_in_chain ( ) : if target_link . parent_task_id == link . task_id and target_link . task_id != link . task_id and target_link . task_type not in PARENT_TASK_TYPES : verify_link_in_task_graph ( chain , link , target_link ) try : await verify_parent_task_definition ( chain , link ) except ( BaseDownloadError , KeyError ) as e : raise CoTError ( e )
Verify the parent task Link.

    Action task verification is currently in the same verification function as
    decision tasks, because sometimes we'll have an action task masquerading as
    a decision task, e.g. in templatized actions for release graphs. To make
    sure our guess of decision or action task isn't fatal, we call this
    function; this function uses ``is_action()`` to determine how to verify
    the task.

    Args:
        chain (ChainOfTrust): the chain we're operating on.
        link (LinkOfTrust): the task link we're checking.

    Raises:
        CoTError: on chain of trust verification error.