def filter_backend_servers()

in src/ansible_collections/alibaba/apsarastack/plugins/modules/ali_slb_vsg.py [0:0]


def filter_backend_servers(existing, inputting):
    old = []
    new = []
    removed = []
    existingList = []
    inputtingList = []
    oldList = []
    inputting = parse_server_ids(inputting)

    for s in existing:
        existingList.append(s['server_id'])

    for s in inputting:
        inputtingList.append(s['server_id'])

    for s in inputting:
        if s['server_id'] in existingList:
            old.append(s)
            oldList.append([s['server_id']])
            continue
        new.append(s)

    for s in existing:
        key = s['server_id']
        if key in inputtingList:
            if key not in oldList:
                old.append(s)
            continue
        removed.append(s)

    return old, new, removed