

def switch_dns_forward(databaseinfra, source_object_list, ip_attribute_name, dns_attribute_name, equivalent_atribute_name, workflow_dict):
    for source_object in source_object_list:
        old_ip = source_object.__getattribute__(ip_attribute_name)
        dns = source_object.__getattribute__(dns_attribute_name)
        source_object.__setattr__(dns_attribute_name, old_ip)
        target_object = source_object.__getattribute__(equivalent_atribute_name)
        new_ip = target_object.__getattribute__(ip_attribute_name)
        source_object.__setattr__(dns_attribute_name, dns)
        LOG.info('Changing {}: from {} to {}'.format(dns, old_ip, new_ip))
        DNSAPIProvider.update_database_dns_content(databaseinfra=databaseinfra, dns=dns, old_ip=old_ip, new_ip=new_ip)
        source_object.save()
        target_object.save()
        workflow_dict['objects_changed'].append({
            'source_object': source_object,
            'ip_attribute_name': ip_attribute_name,
            'dns_attribute_name': dns_attribute_name,
            'equivalent_atribute_name': equivalent_atribute_name,
        })

dataset/ETHPy150Open globocom/database-as-a-service/dbaas/workflow/steps/util/__init__.py switch_dns_forward/VarMisuse@72/149 `target_object`->`source_object`