def _get_default_outcome_dict()

in lib/job_outcome.py [0:0]


def _get_default_outcome_dict(args):
    """Litani's default behavior if the user does not specify an outcome table.

    This is not a constant dict as it also depends on whether the user passed in
    command-line flags that affect how the result is decided, like
    --ignore-returns etc.
    """

    outcomes = []
    if args.timeout_ok:
        outcomes.append({
            "type": "timeout",
            "action": "success",
        })
    elif args.timeout_ignore:
        outcomes.append({
            "type": "timeout",
            "action": "fail_ignored",
        })

    if args.ok_returns:
        for rc in args.ok_returns:
            outcomes.append({
                "type": "return-code",
                "value": int(rc),
                "action": "success",
            })

    if args.ignore_returns:
        for rc in args.ignore_returns:
            outcomes.append({
                "type": "return-code",
                "value": int(rc),
                "action": "fail_ignored",
            })

    outcomes.extend([{
        "type": "return-code",
        "value": 0,
        "action": "success",
    }, {
        "type": "wildcard",
        "action": "fail",
    }])

    return {"outcomes": outcomes}