def check_for_stage_order()

in src/helper.py [0:0]


def check_for_stage_order(dyn_scan_stages, cp_stages):
    """This will compare the DynamoDB Stage order against all CodePipeline Stages

    Args:
        dyn_scan_stages (dict): Dictionary of CodePipeline Stages in a governed order
        cp_stages (list): AWS CodePipeline Stages to be scanned

    Returns:
        :boolean: If stage order matches
    """
    logger.debug(f"dyn_scan_stages:{dyn_scan_stages}")
    logger.debug(f"cp_stages:{cp_stages}")

    # Get just Stage Names from DynamoDB Item and CodePipeline
    _dyn_scan_stages = list(map(lambda x: x['Name'], dyn_scan_stages))
    _cp_stages = list(map(lambda x: x['Name'], cp_stages))

    # Removing Stages that are not mentioned in the dyn_scan_stages
    _stages_to_remove = [x for x in _cp_stages if x not in _dyn_scan_stages]
    for _stage_to_remove in _stages_to_remove:
        _cp_stages.remove(_stage_to_remove)

    logger.debug(f"_dyn_scan_stages:{_dyn_scan_stages}")
    logger.debug(f"_cp_stages:{_cp_stages}")

    return _dyn_scan_stages == _cp_stages