Closed fanshan closed 1 year ago
Hi @fanshan, thanks for your bug report. I'm just trying to understand what happens, as I'm setting up fresh NetBox databases all the time when testing the plugin.
Let's have a look at a test run, particularly the migrations:
(netbox) [root@dns ~]# /opt/netbox/netbox/manage.py test netbox_dns -v2
Found 381 test(s).
Creating test database for alias 'default' ('test_netbox')...
Got an error creating the test database: database "test_netbox" already exists
Type 'yes' if you would like to try deleting the test database 'test_netbox', or 'no' to cancel: yes
Destroying old test database for alias 'default' ('test_netbox')...
Operations to perform:
Synchronize unmigrated apps: corsheaders, debug_toolbar, django_filters, django_prometheus, django_tables2, drf_spectacular, drf_spectacular_sidecar, graphene_django, graphiql_debug_toolbar, humanize, messages, mptt, rest_framework, staticfiles, timezone_field, utilities
Apply all migrations: account, admin, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, netbox_dns, sessions, social_django, taggit, tenancy, users, virtualization, wireless
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying users.0001_squashed_0011... OK
Applying extras.0001_squashed... OK
Applying tenancy.0001_squashed_0012... OK
Applying tenancy.0002_tenant_ordering... OK
Applying dcim.0001_squashed... OK
Applying dcim.0002_squashed... OK
Applying ipam.0001_squashed... OK
Applying virtualization.0001_squashed_0022... OK
Applying extras.0002_squashed_0059... OK
Applying extras.0060_customlink_button_class... OK
Applying extras.0061_extras_change_logging... OK
Applying extras.0062_clear_secrets_changelog... OK
Applying tenancy.0003_contacts... OK
Applying tenancy.0004_extend_tag_support... OK
Applying dcim.0003_squashed_0130... OK
Applying ipam.0002_squashed_0046... OK
Applying ipam.0047_prefix_depth_children... OK
Applying ipam.0048_prefix_populate_depth_children... OK
Applying ipam.0049_prefix_mark_utilized... OK
Applying ipam.0050_iprange... OK
Applying ipam.0051_extend_tag_support... OK
Applying extras.0063_webhook_conditions... OK
Applying extras.0064_configrevision... OK
Applying ipam.0052_fhrpgroup... OK
Applying ipam.0053_asn_model... OK
Applying dcim.0131_consoleport_speed... OK
Applying dcim.0132_cable_length... OK
Applying dcim.0133_port_colors... OK
Applying dcim.0134_interface_wwn_bridge... OK
Applying dcim.0135_tenancy_extensions... OK
Applying dcim.0136_device_airflow... OK
Applying dcim.0137_relax_uniqueness_constraints... OK
Applying dcim.0138_extend_tag_support... OK
Applying dcim.0139_rename_cable_peer... OK
Applying wireless.0001_wireless... OK
Applying dcim.0140_wireless... OK
Applying dcim.0141_asn_model... OK
Applying dcim.0142_rename_128gfc_qsfp28... OK
Applying dcim.0143_remove_primary_for_related_name... OK
Applying dcim.0144_fix_cable_abs_length... OK
Applying dcim.0145_site_remove_deprecated_fields... OK
Applying users.0002_standardize_id_fields... OK
Applying users.0003_token_allowed_ips_last_used... OK
Applying users.0004_netboxgroup_netboxuser... OK
Applying account.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying wireless.0002_standardize_id_fields... OK
Applying wireless.0003_created_datetimefield... OK
Applying tenancy.0005_standardize_id_fields... OK
Applying tenancy.0006_created_datetimefield... OK
Applying tenancy.0007_contact_link... OK
Applying wireless.0004_wireless_tenancy... OK
Applying ipam.0054_vlangroup_min_max_vids... OK
Applying virtualization.0023_virtualmachine_natural_ordering... OK
Applying virtualization.0024_cluster_relax_uniqueness... OK
Applying virtualization.0025_extend_tag_support... OK
Applying virtualization.0026_vminterface_bridge... OK
Applying extras.0065_imageattachment_change_logging... OK
Applying extras.0066_customfield_name_validation... OK
Applying extras.0067_customfield_min_max_values... OK
Applying extras.0068_configcontext_cluster_types... OK
Applying dcim.0146_modules... OK
Applying dcim.0147_inventoryitemrole... OK
Applying dcim.0148_inventoryitem_component... OK
Applying dcim.0149_inventoryitem_templates... OK
Applying dcim.0150_interface_vrf... OK
Applying dcim.0151_interface_speed_duplex... OK
Applying dcim.0152_standardize_id_fields... OK
Applying dcim.0153_created_datetimefield... OK
Applying dcim.0154_half_height_rack_units... OK
Applying dcim.0155_interface_poe_mode_type... OK
Applying dcim.0156_location_status... OK
Applying dcim.0157_new_cabling_models... OK
Applying dcim.0158_populate_cable_terminations... OK
Applying dcim.0159_populate_cable_paths... OK
Applying extras.0069_custom_object_field... OK
Applying extras.0070_customlink_enabled... OK
Applying ipam.0055_servicetemplate... OK
Applying ipam.0056_standardize_id_fields... OK
Applying ipam.0057_created_datetimefield... OK
Applying circuits.0001_squashed... OK
Applying circuits.0002_squashed_0029... OK
Applying circuits.0003_extend_tag_support... OK
Applying circuits.0004_rename_cable_peer... OK
Applying circuits.0032_provider_service_id... OK
Applying circuits.0033_standardize_id_fields... OK
Applying circuits.0034_created_datetimefield... OK
Applying circuits.0035_provider_asns... OK
Applying circuits.0036_circuit_termination_date_tags_custom_fields... OK
Applying circuits.0037_new_cabling_models... OK
Applying dcim.0160_populate_cable_ends... OK
Applying dcim.0161_cabling_cleanup... OK
Applying wireless.0005_wirelesslink_interface_types... OK
Applying wireless.0006_unique_constraints... OK
Applying wireless.0007_standardize_description_comments... OK
Applying wireless.0008_wirelesslan_status... OK
Applying virtualization.0027_standardize_id_fields... OK
Applying virtualization.0028_vminterface_vrf... OK
Applying virtualization.0029_created_datetimefield... OK
Applying virtualization.0030_cluster_status... OK
Applying virtualization.0031_virtualmachine_site_device... OK
Applying virtualization.0032_virtualmachine_update_sites... OK
Applying virtualization.0033_unique_constraints... OK
Applying virtualization.0034_standardize_description_comments... OK
Applying tenancy.0008_unique_constraints... OK
Applying tenancy.0009_standardize_description_comments... OK
Applying ipam.0058_ipaddress_nat_inside_nonunique... OK
Applying extras.0071_standardize_id_fields... OK
Applying extras.0072_created_datetimefield... OK
Applying extras.0073_journalentry_tags_custom_fields... OK
Applying extras.0074_customfield_extensions... OK
Applying extras.0075_configcontext_locations... OK
Applying ipam.0059_l2vpn... OK
Applying ipam.0060_alter_l2vpn_slug... OK
Applying ipam.0061_fhrpgroup_name... OK
Applying ipam.0062_unique_constraints... OK
Applying ipam.0063_standardize_description_comments... OK
Applying extras.0076_tag_slug_unicode... OK
Applying extras.0077_customlink_extend_text_and_url... OK
Applying extras.0078_unique_constraints... OK
Applying extras.0079_scheduled_jobs... OK
Applying extras.0080_customlink_content_types... OK
Applying extras.0081_exporttemplate_content_types... OK
Applying extras.0082_savedfilter... OK
Applying dcim.0162_unique_constraints... OK
Applying dcim.0163_weight_fields... OK
Applying dcim.0164_rack_mounting_depth... OK
Applying dcim.0165_standardize_description_comments... OK
Applying dcim.0166_virtualdevicecontext... OK
Applying circuits.0038_cabling_cleanup... OK
Applying circuits.0039_unique_constraints... OK
Applying circuits.0040_provider_remove_deprecated_fields... OK
Applying circuits.0041_standardize_description_comments... OK
Applying extras.0083_search... OK
Applying extras.0084_staging... OK
Applying circuits.0042_provideraccount... OK
Applying core.0001_initial... OK
Applying core.0002_managedfile... OK
Applying core.0003_job... OK
Applying core.0004_replicate_jobresults... OK
Applying core.0005_job_created_auto_now... OK
Applying tenancy.0010_tenant_relax_uniqueness... OK
Applying ipam.0064_clear_search_cache... OK
Applying extras.0085_synced_data... OK
Applying extras.0086_configtemplate... OK
Applying extras.0087_dashboard... OK
Applying ipam.0065_asnrange... OK
Applying ipam.0066_iprange_mark_utilized... OK
Applying dcim.0167_module_status... OK
Applying dcim.0168_interface_template_enabled... OK
Applying dcim.0169_devicetype_default_platform... OK
Applying dcim.0170_configtemplate... OK
Applying dcim.0171_cabletermination_change_logging... OK
Applying dcim.0172_larger_power_draw_values... OK
Applying dcim.0173_remove_napalm_fields... OK
Applying dcim.0174_device_latitude_device_longitude... OK
Applying dcim.0174_rack_starting_unit... OK
Applying dcim.0175_device_oob_ip... OK
Applying dcim.0176_device_component_counters... OK
Applying dcim.0177_devicetype_component_counters... OK
Applying dcim.0178_virtual_chassis_member_counter... OK
Applying dcim.0179_interfacetemplate_rf_role... OK
Applying dcim.0180_powerfeed_tenant... OK
Applying dcim.0181_rename_device_role_device_role... OK
Applying django_rq.0001_initial... OK
Applying extras.0088_jobresult_webhooks... OK
Applying extras.0089_customfield_is_cloneable... OK
Applying extras.0090_objectchange_index_request_id... OK
Applying extras.0091_create_managedfiles... OK
Applying extras.0092_delete_jobresult... OK
Applying extras.0093_configrevision_ordering... OK
Applying extras.0094_tag_object_types... OK
Applying extras.0095_bookmarks... OK
Applying extras.0096_customfieldchoiceset... OK
Applying extras.0097_customfield_remove_choices... OK
Applying extras.0098_webhook_custom_field_data_webhook_tags... OK
Applying ipam.0067_ipaddress_index_host... OK
Applying netbox_dns.0001_squashed_netbox_dns_0_15... OK
Applying netbox_dns.0020_netbox_3_4... OK
Applying netbox_dns.0021_record_ip_address... OK
Applying netbox_dns.0022_search... OK
Applying netbox_dns.0023_alter_record_value... OK
Applying netbox_dns.0024_tenancy... OK
Applying sessions.0001_initial... OK
Applying social_django.0001_initial... OK
Applying social_django.0002_add_related_name... OK
Applying social_django.0003_alter_email_max_length... OK
Applying social_django.0004_auto_20160423_0400... OK
Applying social_django.0005_auto_20160727_2333... OK
Applying social_django.0006_partial... OK
Applying social_django.0007_code_timestamp... OK
Applying social_django.0008_partial_timestamp... OK
Applying social_django.0009_auto_20191118_0520... OK
Applying social_django.0010_uid_db_index... OK
Applying social_django.0011_alter_id_fields... OK
Applying taggit.0001_initial... OK
Applying taggit.0002_auto_20150616_2121... OK
Applying taggit.0003_taggeditem_add_unique_index... OK
Applying taggit.0004_alter_taggeditem_content_type_alter_taggeditem_tag... OK
Applying taggit.0005_auto_20220424_2025... OK
Applying tenancy.0011_contactassignment_tags... OK
Applying virtualization.0035_virtualmachine_interface_count... OK
Applying virtualization.0036_virtualmachine_config_template... OK
As you can see, when I run the tests with a fresh database in place all the migrations run perfectly, even netbox_dns.0022_search
. Obviously it does not do that for you, and the question is why. I assume the reason is within the code of that migration, which does not execute the re-indexing code in test mode.
When not in test mode it tries to reindex the tables according to their models, which contain the tenant_id
column starting from version 0.19.0. However, that column is only added in netbox_dns.0024_tenancy
, and hence the error that is not found by the tests. Bummer.
I'll push an update in about half an hour (if nothing interferes).
0.19.3 has been released. Please check if it fixes your issue.
Hello, @peteeckel thank you very much for the quick update. I made some check and the update fix the issue :-)
Hello, @peteeckel thank you very much for the quick update. I made some check and the update fix the issue :-)
Thanks for the feedback! Closing this now.
Hello,
I am unable to install the plugin since v0.19.0 on fresh Netbox install.
Versions NetBox Version: 3.6.1 NetBox DNS Version: >=0.19.0 Python Version: 3.11.4
Describe the bug
When we want to install a fresh Netbox installation with the plugin, migration fail when netbox_dns.0022_search migration file is processed.
To Reproduce Steps to reproduce the behavior:
Expected result
Netbox fresh installation should succed with all migration processed.
Actual result
The error message is (I tuncated the full log before the error):