3679e6a Fix race condition in get_locations_records()

Authored and Committed by cheimes 5 years ago
    Fix race condition in get_locations_records()
    
    The method IPASystemRecords.get_locations_records() has a race condition.
    The IPASystemRecords object creates a mapping of server names to server
    data. get_locations_records() uses server_find() again to get a list of
    servers, but then operates on the cached dict of server names.
    
    In parallel replication case, the second server_find() call in
    get_locations_records() can return additional servers. Since the rest of
    the code operates on the cached data, the method then fails with a KeyError.
    
    server_data is now an OrderedDict to keep same sorting as with
    server_find().
    
    Fixes: https://pagure.io/freeipa/issue/7566
    Signed-off-by: Christian Heimes <cheimes@redhat.com>
    Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>