def set_to_replace()

in backend/lambda_function.py [0:0]


def set_to_replace(primary,secondary,public_dns_name,eventid):
    
    # This function will set the servers to be replaces by futures ones
    
    # This will configure the metadata of the primary server to be replaced by the new future server
    if (primary.get('dns') == public_dns_name) and (primary.get('role') == 'primary') and (primary.get('replaced') == 'no') and (primary.get('eventid') != eventid) and (secondary.get('eventid') != eventid):
        
            update_values('primary','yes',eventid)
            #print('First IF')
            return None

    # This will configure the metadata of the primary server to be replaced by the new future server
    elif (secondary.get('dns') == public_dns_name) and (secondary.get('role') == 'secondary') and (secondary.get('replaced') == 'no') and (secondary.get('eventid') != eventid) and (primary.get('eventid') != eventid):
            
            update_values('secondary','yes',eventid)
            #print('Second IF')
            return None