netbox-plugin-dns 0.21.4__py3-none-any.whl → 1.4.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netbox_dns/__init__.py +106 -41
- netbox_dns/api/field_serializers.py +25 -0
- netbox_dns/api/nested_serializers.py +95 -52
- netbox_dns/api/serializers.py +14 -296
- netbox_dns/api/serializers_/__init__.py +0 -0
- netbox_dns/api/serializers_/dnssec_key_template.py +69 -0
- netbox_dns/api/serializers_/dnssec_policy.py +165 -0
- netbox_dns/api/serializers_/nameserver.py +56 -0
- netbox_dns/api/serializers_/prefix.py +18 -0
- netbox_dns/api/serializers_/record.py +105 -0
- netbox_dns/api/serializers_/record_template.py +71 -0
- netbox_dns/api/serializers_/registrar.py +45 -0
- netbox_dns/api/serializers_/registration_contact.py +50 -0
- netbox_dns/api/serializers_/view.py +81 -0
- netbox_dns/api/serializers_/zone.py +247 -0
- netbox_dns/api/serializers_/zone_template.py +157 -0
- netbox_dns/api/urls.py +13 -2
- netbox_dns/api/views.py +96 -58
- netbox_dns/choices/__init__.py +4 -0
- netbox_dns/choices/dnssec_key_template.py +67 -0
- netbox_dns/choices/dnssec_policy.py +40 -0
- netbox_dns/choices/record.py +104 -0
- netbox_dns/choices/utilities.py +4 -0
- netbox_dns/choices/zone.py +119 -0
- netbox_dns/fields/__init__.py +4 -0
- netbox_dns/fields/address.py +22 -16
- netbox_dns/fields/choice_array.py +33 -0
- netbox_dns/fields/ipam.py +15 -0
- netbox_dns/fields/network.py +42 -18
- netbox_dns/fields/rfc2317.py +97 -0
- netbox_dns/fields/timeperiod.py +33 -0
- netbox_dns/filters.py +7 -0
- netbox_dns/filtersets/__init__.py +12 -0
- netbox_dns/filtersets/dnssec_key_template.py +57 -0
- netbox_dns/filtersets/dnssec_policy.py +101 -0
- netbox_dns/filtersets/nameserver.py +46 -0
- netbox_dns/filtersets/record.py +135 -0
- netbox_dns/filtersets/record_template.py +59 -0
- netbox_dns/{filters → filtersets}/registrar.py +8 -1
- netbox_dns/{filters/contact.py → filtersets/registration_contact.py} +9 -3
- netbox_dns/filtersets/view.py +45 -0
- netbox_dns/filtersets/zone.py +254 -0
- netbox_dns/filtersets/zone_template.py +165 -0
- netbox_dns/forms/__init__.py +5 -1
- netbox_dns/forms/dnssec_key_template.py +250 -0
- netbox_dns/forms/dnssec_policy.py +654 -0
- netbox_dns/forms/nameserver.py +121 -27
- netbox_dns/forms/record.py +215 -104
- netbox_dns/forms/record_template.py +285 -0
- netbox_dns/forms/registrar.py +108 -31
- netbox_dns/forms/registration_contact.py +282 -0
- netbox_dns/forms/view.py +331 -20
- netbox_dns/forms/zone.py +769 -373
- netbox_dns/forms/zone_template.py +463 -0
- netbox_dns/graphql/__init__.py +25 -22
- netbox_dns/graphql/enums.py +41 -0
- netbox_dns/graphql/filter_lookups.py +13 -0
- netbox_dns/graphql/filters/__init__.py +12 -0
- netbox_dns/graphql/filters/dnssec_key_template.py +63 -0
- netbox_dns/graphql/filters/dnssec_policy.py +124 -0
- netbox_dns/graphql/filters/nameserver.py +32 -0
- netbox_dns/graphql/filters/record.py +89 -0
- netbox_dns/graphql/filters/record_template.py +55 -0
- netbox_dns/graphql/filters/registrar.py +30 -0
- netbox_dns/graphql/filters/registration_contact.py +27 -0
- netbox_dns/graphql/filters/view.py +28 -0
- netbox_dns/graphql/filters/zone.py +147 -0
- netbox_dns/graphql/filters/zone_template.py +97 -0
- netbox_dns/graphql/schema.py +89 -7
- netbox_dns/graphql/types.py +355 -0
- netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/en/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_dns/management/commands/cleanup_database.py +175 -156
- netbox_dns/management/commands/cleanup_rrset_ttl.py +64 -0
- netbox_dns/management/commands/rebuild_dnssync.py +23 -0
- netbox_dns/management/commands/setup_dnssync.py +140 -0
- netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +557 -0
- netbox_dns/migrations/{0013_add_nameserver_zone_record_description.py → 0002_contact_description_registrar_description.py} +4 -9
- netbox_dns/migrations/0003_default_view.py +15 -0
- netbox_dns/migrations/0004_create_and_assign_default_view.py +26 -0
- netbox_dns/migrations/0005_alter_zone_view_not_null.py +18 -0
- netbox_dns/migrations/0006_templating.py +172 -0
- netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
- netbox_dns/migrations/0008_view_prefixes.py +18 -0
- netbox_dns/migrations/0009_rename_contact_registrationcontact.py +36 -0
- netbox_dns/migrations/0010_view_ip_address_filter.py +18 -0
- netbox_dns/migrations/0011_rename_related_fields.py +63 -0
- netbox_dns/migrations/0012_natural_ordering.py +88 -0
- netbox_dns/migrations/0013_zonetemplate_soa_mname_zonetemplate_soa_rname.py +30 -0
- netbox_dns/migrations/0014_alter_unique_constraints_lowercase.py +42 -0
- netbox_dns/migrations/0015_dnssec.py +168 -0
- netbox_dns/migrations/{0015_add_record_status.py → 0016_dnssec_policy_status.py} +5 -4
- netbox_dns/migrations/0017_dnssec_policy_zone_zone_template.py +41 -0
- netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
- netbox_dns/migrations/0019_dnssecpolicy_parental_agents.py +25 -0
- netbox_dns/migrations/0020_netbox_3_4.py +1 -1
- netbox_dns/migrations/0020_remove_dnssecpolicy_parental_agents_and_more.py +29 -0
- netbox_dns/migrations/0021_alter_record_ptr_record.py +25 -0
- netbox_dns/migrations/0021_record_ip_address.py +1 -1
- netbox_dns/migrations/0022_alter_record_ipam_ip_address.py +26 -0
- netbox_dns/migrations/0023_disable_ptr_false.py +27 -0
- netbox_dns/migrations/0024_zonetemplate_parental_agents.py +25 -0
- netbox_dns/migrations/0025_remove_zone_inline_signing_and_more.py +22 -0
- netbox_dns/migrations/0026_alter_dnssecpolicy_nsec3_opt_out.py +18 -0
- netbox_dns/migrations/0026_domain_registration.py +1 -1
- netbox_dns/migrations/0027_zone_comments.py +18 -0
- netbox_dns/migrations/0028_alter_zone_default_ttl_alter_zone_soa_minimum_and_more.py +54 -0
- netbox_dns/migrations/0028_rfc2317_fields.py +44 -0
- netbox_dns/migrations/0029_alter_registrationcontact_street.py +18 -0
- netbox_dns/migrations/0029_record_fqdn.py +30 -0
- netbox_dns/mixins/__init__.py +1 -0
- netbox_dns/mixins/object_modification.py +57 -0
- netbox_dns/models/__init__.py +5 -1
- netbox_dns/models/dnssec_key_template.py +114 -0
- netbox_dns/models/dnssec_policy.py +203 -0
- netbox_dns/models/nameserver.py +61 -30
- netbox_dns/models/record.py +781 -234
- netbox_dns/models/record_template.py +198 -0
- netbox_dns/models/registrar.py +34 -15
- netbox_dns/models/{contact.py → registration_contact.py} +72 -43
- netbox_dns/models/view.py +129 -9
- netbox_dns/models/zone.py +806 -242
- netbox_dns/models/zone_template.py +209 -0
- netbox_dns/navigation.py +176 -76
- netbox_dns/signals/__init__.py +0 -0
- netbox_dns/signals/dnssec.py +32 -0
- netbox_dns/signals/ipam_dnssync.py +216 -0
- netbox_dns/tables/__init__.py +5 -1
- netbox_dns/tables/dnssec_key_template.py +49 -0
- netbox_dns/tables/dnssec_policy.py +140 -0
- netbox_dns/tables/ipam_dnssync.py +12 -0
- netbox_dns/tables/nameserver.py +14 -17
- netbox_dns/tables/record.py +117 -59
- netbox_dns/tables/record_template.py +91 -0
- netbox_dns/tables/registrar.py +20 -10
- netbox_dns/tables/{contact.py → registration_contact.py} +22 -11
- netbox_dns/tables/view.py +47 -3
- netbox_dns/tables/zone.py +62 -31
- netbox_dns/tables/zone_template.py +78 -0
- netbox_dns/template_content.py +124 -38
- netbox_dns/templates/netbox_dns/dnsseckeytemplate.html +70 -0
- netbox_dns/templates/netbox_dns/dnssecpolicy.html +163 -0
- netbox_dns/templates/netbox_dns/nameserver.html +31 -28
- netbox_dns/templates/netbox_dns/record/managed.html +2 -1
- netbox_dns/templates/netbox_dns/record/related.html +17 -6
- netbox_dns/templates/netbox_dns/record.html +140 -93
- netbox_dns/templates/netbox_dns/recordtemplate.html +96 -0
- netbox_dns/templates/netbox_dns/registrar.html +41 -34
- netbox_dns/templates/netbox_dns/registrationcontact.html +76 -0
- netbox_dns/templates/netbox_dns/view/button.html +10 -0
- netbox_dns/templates/netbox_dns/view/prefix.html +44 -0
- netbox_dns/templates/netbox_dns/view/related.html +33 -0
- netbox_dns/templates/netbox_dns/view.html +62 -18
- netbox_dns/templates/netbox_dns/zone/base.html +6 -3
- netbox_dns/templates/netbox_dns/zone/child.html +6 -5
- netbox_dns/templates/netbox_dns/zone/child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone/delegation_record.html +18 -0
- netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
- netbox_dns/templates/netbox_dns/zone/record.html +6 -5
- netbox_dns/templates/netbox_dns/zone/registration.html +43 -24
- netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone.html +178 -119
- netbox_dns/templates/netbox_dns/zonetemplate/child.html +46 -0
- netbox_dns/templates/netbox_dns/zonetemplate.html +124 -0
- netbox_dns/templatetags/netbox_dns.py +10 -0
- netbox_dns/urls.py +50 -210
- netbox_dns/utilities/__init__.py +3 -0
- netbox_dns/{utilities.py → utilities/conversions.py} +55 -7
- netbox_dns/utilities/dns.py +11 -0
- netbox_dns/utilities/ipam_dnssync.py +370 -0
- netbox_dns/validators/__init__.py +4 -0
- netbox_dns/validators/dns_name.py +116 -0
- netbox_dns/validators/dns_value.py +147 -0
- netbox_dns/validators/dnssec.py +148 -0
- netbox_dns/validators/rfc2317.py +28 -0
- netbox_dns/views/__init__.py +5 -1
- netbox_dns/views/dnssec_key_template.py +78 -0
- netbox_dns/views/dnssec_policy.py +146 -0
- netbox_dns/views/nameserver.py +34 -15
- netbox_dns/views/record.py +156 -15
- netbox_dns/views/record_template.py +93 -0
- netbox_dns/views/registrar.py +32 -13
- netbox_dns/views/registration_contact.py +101 -0
- netbox_dns/views/view.py +58 -14
- netbox_dns/views/zone.py +130 -33
- netbox_dns/views/zone_template.py +82 -0
- netbox_plugin_dns-1.4.7.dist-info/METADATA +132 -0
- netbox_plugin_dns-1.4.7.dist-info/RECORD +201 -0
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info}/WHEEL +2 -1
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info/licenses}/LICENSE +2 -1
- netbox_plugin_dns-1.4.7.dist-info/top_level.txt +1 -0
- netbox_dns/filters/__init__.py +0 -6
- netbox_dns/filters/nameserver.py +0 -18
- netbox_dns/filters/record.py +0 -53
- netbox_dns/filters/view.py +0 -18
- netbox_dns/filters/zone.py +0 -112
- netbox_dns/forms/contact.py +0 -211
- netbox_dns/graphql/contact.py +0 -19
- netbox_dns/graphql/nameserver.py +0 -19
- netbox_dns/graphql/record.py +0 -19
- netbox_dns/graphql/registrar.py +0 -19
- netbox_dns/graphql/view.py +0 -19
- netbox_dns/graphql/zone.py +0 -19
- netbox_dns/management/commands/setup_coupling.py +0 -75
- netbox_dns/management/commands/update_soa.py +0 -22
- netbox_dns/middleware.py +0 -226
- netbox_dns/migrations/0001_initial.py +0 -115
- netbox_dns/migrations/0002_zone_default_ttl.py +0 -18
- netbox_dns/migrations/0003_soa_managed_records.py +0 -112
- netbox_dns/migrations/0004_create_ptr_for_a_aaaa_records.py +0 -80
- netbox_dns/migrations/0005_update_ns_records.py +0 -41
- netbox_dns/migrations/0006_zone_soa_serial_auto.py +0 -29
- netbox_dns/migrations/0007_alter_zone_soa_serial_auto.py +0 -17
- netbox_dns/migrations/0008_zone_status_names.py +0 -21
- netbox_dns/migrations/0009_netbox32.py +0 -71
- netbox_dns/migrations/0010_update_soa_records.py +0 -58
- netbox_dns/migrations/0011_add_view_model.py +0 -70
- netbox_dns/migrations/0012_adjust_zone_and_record.py +0 -17
- netbox_dns/migrations/0014_add_view_description.py +0 -16
- netbox_dns/migrations/0016_cleanup_ptr_records.py +0 -38
- netbox_dns/migrations/0017_alter_record_ttl.py +0 -17
- netbox_dns/migrations/0018_zone_arpa_network.py +0 -51
- netbox_dns/migrations/0019_update_ns_ttl.py +0 -19
- netbox_dns/templates/netbox_dns/contact.html +0 -71
- netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
- netbox_dns/templatetags/view_helpers.py +0 -15
- netbox_dns/validators.py +0 -57
- netbox_dns/views/contact.py +0 -83
- netbox_plugin_dns-0.21.4.dist-info/METADATA +0 -101
- netbox_plugin_dns-0.21.4.dist-info/RECORD +0 -110
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Generated by Django 3.2.9 on 2021-11-06 18:53
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
from django.db import migrations, models
|
|
6
|
-
from django.db.models import Q, deletion
|
|
7
|
-
|
|
8
|
-
from netbox_dns.models import RecordTypeChoices
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def cleanup_disable_ptr(apps, schema_editor):
|
|
12
|
-
logger = logging.getLogger("django")
|
|
13
|
-
|
|
14
|
-
Record = apps.get_model("netbox_dns", "Record")
|
|
15
|
-
|
|
16
|
-
unique_ptr_qs = Q(
|
|
17
|
-
Q(disable_ptr=False),
|
|
18
|
-
Q(Q(type=RecordTypeChoices.A) | Q(type=RecordTypeChoices.AAAA)),
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
for record in Record.objects.filter(unique_ptr_qs):
|
|
22
|
-
logger.warning(
|
|
23
|
-
"Disabling PTR generation for record %s:%s in zone %s",
|
|
24
|
-
record.type,
|
|
25
|
-
record.name,
|
|
26
|
-
record.zone.name,
|
|
27
|
-
)
|
|
28
|
-
record.disable_ptr = True
|
|
29
|
-
record.save()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class Migration(migrations.Migration):
|
|
33
|
-
atomic = False
|
|
34
|
-
|
|
35
|
-
dependencies = [
|
|
36
|
-
("netbox_dns", "0003_soa_managed_records"),
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
operations = [
|
|
40
|
-
migrations.AlterModelOptions(
|
|
41
|
-
name="nameserver",
|
|
42
|
-
options={"ordering": ("name",)},
|
|
43
|
-
),
|
|
44
|
-
migrations.AlterModelOptions(
|
|
45
|
-
name="record",
|
|
46
|
-
options={"ordering": ("zone", "name", "type", "value")},
|
|
47
|
-
),
|
|
48
|
-
migrations.AddField(
|
|
49
|
-
model_name="record",
|
|
50
|
-
name="disable_ptr",
|
|
51
|
-
field=models.BooleanField(default=False),
|
|
52
|
-
),
|
|
53
|
-
migrations.AddField(
|
|
54
|
-
model_name="record",
|
|
55
|
-
name="ptr_record",
|
|
56
|
-
field=models.OneToOneField(
|
|
57
|
-
blank=True,
|
|
58
|
-
null=True,
|
|
59
|
-
on_delete=deletion.SET_NULL,
|
|
60
|
-
related_name="address_record",
|
|
61
|
-
to="netbox_dns.record",
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
migrations.RunPython(cleanup_disable_ptr),
|
|
65
|
-
migrations.AddConstraint(
|
|
66
|
-
model_name="record",
|
|
67
|
-
constraint=models.UniqueConstraint(
|
|
68
|
-
condition=Q(
|
|
69
|
-
Q(("disable_ptr", False)),
|
|
70
|
-
Q(
|
|
71
|
-
("type", RecordTypeChoices.A),
|
|
72
|
-
("type", RecordTypeChoices.AAAA),
|
|
73
|
-
_connector="OR",
|
|
74
|
-
),
|
|
75
|
-
),
|
|
76
|
-
fields=("type", "value"),
|
|
77
|
-
name="unique_pointer_for_address",
|
|
78
|
-
),
|
|
79
|
-
),
|
|
80
|
-
]
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Generated by Django 3.2.9 on 2021-11-26 07:01
|
|
2
|
-
|
|
3
|
-
from django.db import migrations
|
|
4
|
-
from netbox_dns.models import Record, RecordTypeChoices
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def create_initial_ns_records(apps, schema_editor):
|
|
8
|
-
Zone = apps.get_model("netbox_dns", "Zone")
|
|
9
|
-
|
|
10
|
-
for zone in Zone.objects.all():
|
|
11
|
-
nameservers = zone.nameservers.all()
|
|
12
|
-
nameserver_names = [f'{ns.name.rstrip(".")}.' for ns in nameservers]
|
|
13
|
-
|
|
14
|
-
ns_name = "@"
|
|
15
|
-
ns_ttl = zone.default_ttl
|
|
16
|
-
|
|
17
|
-
delete_ns = zone.record_set.filter(
|
|
18
|
-
type=RecordTypeChoices.NS, managed=True
|
|
19
|
-
).exclude(value__in=nameserver_names)
|
|
20
|
-
for record in delete_ns:
|
|
21
|
-
record.delete()
|
|
22
|
-
|
|
23
|
-
for ns in nameserver_names:
|
|
24
|
-
Record.objects.update_or_create(
|
|
25
|
-
zone_id=zone.pk,
|
|
26
|
-
type=RecordTypeChoices.NS,
|
|
27
|
-
name=ns_name,
|
|
28
|
-
ttl=ns_ttl,
|
|
29
|
-
value=ns,
|
|
30
|
-
managed=True,
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class Migration(migrations.Migration):
|
|
35
|
-
dependencies = [
|
|
36
|
-
("netbox_dns", "0007_alter_zone_soa_serial_auto"),
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
operations = [
|
|
40
|
-
migrations.RunPython(create_initial_ns_records),
|
|
41
|
-
]
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Generated by Django 3.2.9 on 2021-11-26 16:54
|
|
2
|
-
|
|
3
|
-
import django.core.validators
|
|
4
|
-
from django.db import migrations, models
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Migration(migrations.Migration):
|
|
8
|
-
dependencies = [("netbox_dns", "0004_create_ptr_for_a_aaaa_records")]
|
|
9
|
-
|
|
10
|
-
operations = [
|
|
11
|
-
migrations.AddField(
|
|
12
|
-
model_name="zone",
|
|
13
|
-
name="soa_serial_auto",
|
|
14
|
-
field=models.BooleanField(default=False),
|
|
15
|
-
preserve_default=False,
|
|
16
|
-
),
|
|
17
|
-
migrations.AlterField(
|
|
18
|
-
model_name="zone",
|
|
19
|
-
name="soa_serial",
|
|
20
|
-
field=models.BigIntegerField(
|
|
21
|
-
blank=True,
|
|
22
|
-
null=True,
|
|
23
|
-
validators=[
|
|
24
|
-
django.core.validators.MinValueValidator(1),
|
|
25
|
-
django.core.validators.MaxValueValidator(4294967295),
|
|
26
|
-
],
|
|
27
|
-
),
|
|
28
|
-
),
|
|
29
|
-
]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Generated by Django 3.2.9 on 2021-12-13 20:44
|
|
2
|
-
|
|
3
|
-
from django.db import migrations, models
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Migration(migrations.Migration):
|
|
7
|
-
dependencies = [
|
|
8
|
-
("netbox_dns", "0006_zone_soa_serial_auto"),
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
operations = [
|
|
12
|
-
migrations.AlterField(
|
|
13
|
-
model_name="zone",
|
|
14
|
-
name="soa_serial_auto",
|
|
15
|
-
field=models.BooleanField(default=True),
|
|
16
|
-
),
|
|
17
|
-
]
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from django.db import migrations
|
|
2
|
-
|
|
3
|
-
from netbox_dns.models import ZoneStatusChoices
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def rename_passive_status_to_parked(apps, schema_editor):
|
|
7
|
-
Zone = apps.get_model("netbox_dns", "Zone")
|
|
8
|
-
|
|
9
|
-
for zone in Zone.objects.filter(status="passive"):
|
|
10
|
-
zone.status = ZoneStatusChoices.STATUS_PARKED
|
|
11
|
-
zone.save()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Migration(migrations.Migration):
|
|
15
|
-
dependencies = [
|
|
16
|
-
("netbox_dns", "0005_update_ns_records"),
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
operations = [
|
|
20
|
-
migrations.RunPython(rename_passive_status_to_parked),
|
|
21
|
-
]
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Generated by Django 4.0.2 on 2022-02-09 15:44
|
|
2
|
-
|
|
3
|
-
from django.db import migrations, models
|
|
4
|
-
import taggit.managers
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Migration(migrations.Migration):
|
|
8
|
-
dependencies = [
|
|
9
|
-
("extras", "0072_created_datetimefield"),
|
|
10
|
-
("netbox_dns", "0008_zone_status_names"),
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
operations = [
|
|
14
|
-
migrations.AlterField(
|
|
15
|
-
model_name="nameserver",
|
|
16
|
-
name="created",
|
|
17
|
-
field=models.DateTimeField(auto_now_add=True, null=True),
|
|
18
|
-
),
|
|
19
|
-
migrations.AlterField(
|
|
20
|
-
model_name="nameserver",
|
|
21
|
-
name="id",
|
|
22
|
-
field=models.BigAutoField(
|
|
23
|
-
auto_created=True, primary_key=True, serialize=False
|
|
24
|
-
),
|
|
25
|
-
),
|
|
26
|
-
migrations.AlterField(
|
|
27
|
-
model_name="nameserver",
|
|
28
|
-
name="tags",
|
|
29
|
-
field=taggit.managers.TaggableManager(
|
|
30
|
-
through="extras.TaggedItem", to="extras.Tag"
|
|
31
|
-
),
|
|
32
|
-
),
|
|
33
|
-
migrations.AlterField(
|
|
34
|
-
model_name="record",
|
|
35
|
-
name="created",
|
|
36
|
-
field=models.DateTimeField(auto_now_add=True, null=True),
|
|
37
|
-
),
|
|
38
|
-
migrations.AlterField(
|
|
39
|
-
model_name="record",
|
|
40
|
-
name="id",
|
|
41
|
-
field=models.BigAutoField(
|
|
42
|
-
auto_created=True, primary_key=True, serialize=False
|
|
43
|
-
),
|
|
44
|
-
),
|
|
45
|
-
migrations.AlterField(
|
|
46
|
-
model_name="record",
|
|
47
|
-
name="tags",
|
|
48
|
-
field=taggit.managers.TaggableManager(
|
|
49
|
-
through="extras.TaggedItem", to="extras.Tag"
|
|
50
|
-
),
|
|
51
|
-
),
|
|
52
|
-
migrations.AlterField(
|
|
53
|
-
model_name="zone",
|
|
54
|
-
name="created",
|
|
55
|
-
field=models.DateTimeField(auto_now_add=True, null=True),
|
|
56
|
-
),
|
|
57
|
-
migrations.AlterField(
|
|
58
|
-
model_name="zone",
|
|
59
|
-
name="id",
|
|
60
|
-
field=models.BigAutoField(
|
|
61
|
-
auto_created=True, primary_key=True, serialize=False
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
migrations.AlterField(
|
|
65
|
-
model_name="zone",
|
|
66
|
-
name="tags",
|
|
67
|
-
field=taggit.managers.TaggableManager(
|
|
68
|
-
through="extras.TaggedItem", to="extras.Tag"
|
|
69
|
-
),
|
|
70
|
-
),
|
|
71
|
-
]
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
from django.db import migrations
|
|
2
|
-
from netbox_dns.models import Record, RecordTypeChoices
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def absolute_name(name):
|
|
6
|
-
if name.endswith("."):
|
|
7
|
-
return name
|
|
8
|
-
return f"{name}."
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def update_soa_record(zone):
|
|
12
|
-
soa_name = "@"
|
|
13
|
-
soa_ttl = zone.soa_ttl
|
|
14
|
-
soa_value = (
|
|
15
|
-
f"({absolute_name(zone.soa_mname.name)} {absolute_name(zone.soa_rname)}"
|
|
16
|
-
f" {zone.soa_serial}"
|
|
17
|
-
f" {zone.soa_refresh} {zone.soa_retry} {zone.soa_expire}"
|
|
18
|
-
f" {zone.soa_minimum})"
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
old_soa_records = zone.record_set.filter(type=RecordTypeChoices.SOA, name=soa_name)
|
|
22
|
-
|
|
23
|
-
if len(old_soa_records):
|
|
24
|
-
for index, record in enumerate(old_soa_records):
|
|
25
|
-
if index > 0:
|
|
26
|
-
record.delete()
|
|
27
|
-
continue
|
|
28
|
-
|
|
29
|
-
if record.ttl != soa_ttl or record.value != soa_value:
|
|
30
|
-
record.ttl = soa_ttl
|
|
31
|
-
record.value = soa_value
|
|
32
|
-
record.managed = True
|
|
33
|
-
record.save()
|
|
34
|
-
else:
|
|
35
|
-
Record.objects.create(
|
|
36
|
-
zone_id=zone.pk,
|
|
37
|
-
type=RecordTypeChoices.SOA,
|
|
38
|
-
name=soa_name,
|
|
39
|
-
ttl=soa_ttl,
|
|
40
|
-
value=soa_value,
|
|
41
|
-
managed=True,
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def update_soa_records(apps, schema_editor):
|
|
46
|
-
Zone = apps.get_model("netbox_dns", "Zone")
|
|
47
|
-
|
|
48
|
-
for zone in Zone.objects.all():
|
|
49
|
-
update_soa_record(zone)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class Migration(migrations.Migration):
|
|
53
|
-
dependencies = [
|
|
54
|
-
("netbox_dns", "0009_netbox32"),
|
|
55
|
-
]
|
|
56
|
-
operations = [
|
|
57
|
-
migrations.RunPython(update_soa_records),
|
|
58
|
-
]
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Generated by Django 4.0.4 on 2022-04-22 17:18
|
|
2
|
-
|
|
3
|
-
import django.core.serializers.json
|
|
4
|
-
from django.db import migrations, models
|
|
5
|
-
import django.db.models.deletion
|
|
6
|
-
import taggit.managers
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Migration(migrations.Migration):
|
|
10
|
-
dependencies = [
|
|
11
|
-
("extras", "0073_journalentry_tags_custom_fields"),
|
|
12
|
-
("netbox_dns", "0001_initial"),
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
operations = [
|
|
16
|
-
migrations.AlterModelOptions(
|
|
17
|
-
name="zone",
|
|
18
|
-
options={"ordering": ("view", "name")},
|
|
19
|
-
),
|
|
20
|
-
migrations.AlterField(
|
|
21
|
-
model_name="zone",
|
|
22
|
-
name="name",
|
|
23
|
-
field=models.CharField(max_length=255),
|
|
24
|
-
),
|
|
25
|
-
migrations.CreateModel(
|
|
26
|
-
name="View",
|
|
27
|
-
fields=[
|
|
28
|
-
(
|
|
29
|
-
"id",
|
|
30
|
-
models.BigAutoField(
|
|
31
|
-
auto_created=True, primary_key=True, serialize=False
|
|
32
|
-
),
|
|
33
|
-
),
|
|
34
|
-
("created", models.DateTimeField(auto_now_add=True, null=True)),
|
|
35
|
-
("last_updated", models.DateTimeField(auto_now=True, null=True)),
|
|
36
|
-
(
|
|
37
|
-
"custom_field_data",
|
|
38
|
-
models.JSONField(
|
|
39
|
-
blank=True,
|
|
40
|
-
default=dict,
|
|
41
|
-
encoder=django.core.serializers.json.DjangoJSONEncoder,
|
|
42
|
-
),
|
|
43
|
-
),
|
|
44
|
-
("name", models.CharField(max_length=255, unique=True)),
|
|
45
|
-
(
|
|
46
|
-
"tags",
|
|
47
|
-
taggit.managers.TaggableManager(
|
|
48
|
-
through="extras.TaggedItem", to="extras.Tag"
|
|
49
|
-
),
|
|
50
|
-
),
|
|
51
|
-
],
|
|
52
|
-
options={
|
|
53
|
-
"ordering": ("name",),
|
|
54
|
-
},
|
|
55
|
-
),
|
|
56
|
-
migrations.AddField(
|
|
57
|
-
model_name="zone",
|
|
58
|
-
name="view",
|
|
59
|
-
field=models.ForeignKey(
|
|
60
|
-
blank=True,
|
|
61
|
-
null=True,
|
|
62
|
-
on_delete=django.db.models.deletion.PROTECT,
|
|
63
|
-
to="netbox_dns.view",
|
|
64
|
-
),
|
|
65
|
-
),
|
|
66
|
-
migrations.AlterUniqueTogether(
|
|
67
|
-
name="zone",
|
|
68
|
-
unique_together={("view", "name")},
|
|
69
|
-
),
|
|
70
|
-
]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Generated by Django 4.0.4 on 2022-04-26 17:51
|
|
2
|
-
|
|
3
|
-
from django.db import migrations
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Migration(migrations.Migration):
|
|
7
|
-
dependencies = [
|
|
8
|
-
("netbox_dns", "0010_update_soa_records"),
|
|
9
|
-
("netbox_dns", "0011_add_view_model"),
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
operations = [
|
|
13
|
-
migrations.RemoveConstraint(
|
|
14
|
-
model_name="record",
|
|
15
|
-
name="unique_pointer_for_address",
|
|
16
|
-
),
|
|
17
|
-
]
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from django.db import migrations, models
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class Migration(migrations.Migration):
|
|
5
|
-
dependencies = [
|
|
6
|
-
("netbox_dns", "0012_adjust_zone_and_record"),
|
|
7
|
-
("netbox_dns", "0013_add_nameserver_zone_record_description"),
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
operations = [
|
|
11
|
-
migrations.AddField(
|
|
12
|
-
model_name="view",
|
|
13
|
-
name="description",
|
|
14
|
-
field=models.CharField(blank=True, max_length=200),
|
|
15
|
-
),
|
|
16
|
-
]
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
from django.db import migrations
|
|
4
|
-
from django.db.models import Q
|
|
5
|
-
|
|
6
|
-
from netbox_dns.models import ZoneStatusChoices
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def delete_ptr_records_for_inactive_zones(apps, schema_editor):
|
|
10
|
-
logger = logging.getLogger("django")
|
|
11
|
-
|
|
12
|
-
Record = apps.get_model("netbox_dns", "Record")
|
|
13
|
-
|
|
14
|
-
for record in Record.objects.exclude(
|
|
15
|
-
Q(Q(ptr_record__isnull=True) | Q(zone__status=ZoneStatusChoices.STATUS_ACTIVE))
|
|
16
|
-
):
|
|
17
|
-
logger.warning(
|
|
18
|
-
"Deleting PTR for record %s:%s in zone %s",
|
|
19
|
-
record.type,
|
|
20
|
-
record.name,
|
|
21
|
-
record.zone.name,
|
|
22
|
-
)
|
|
23
|
-
record.ptr_record.delete()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class Migration(migrations.Migration):
|
|
27
|
-
dependencies = [
|
|
28
|
-
("netbox_dns", "0014_add_view_description"),
|
|
29
|
-
("netbox_dns", "0015_add_record_status"),
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
operations = [
|
|
33
|
-
migrations.AlterModelOptions(
|
|
34
|
-
name="record",
|
|
35
|
-
options={"ordering": ("zone", "name", "type", "value", "status")},
|
|
36
|
-
),
|
|
37
|
-
migrations.RunPython(delete_ptr_records_for_inactive_zones),
|
|
38
|
-
]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Generated by Django 4.0.8 on 2022-10-18 07:53
|
|
2
|
-
|
|
3
|
-
from django.db import migrations, models
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Migration(migrations.Migration):
|
|
7
|
-
dependencies = [
|
|
8
|
-
("netbox_dns", "0016_cleanup_ptr_records"),
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
operations = [
|
|
12
|
-
migrations.AlterField(
|
|
13
|
-
model_name="record",
|
|
14
|
-
name="ttl",
|
|
15
|
-
field=models.PositiveIntegerField(blank=True, null=True),
|
|
16
|
-
),
|
|
17
|
-
]
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Generated by Django 4.0.8 on 2022-10-26 18:55
|
|
2
|
-
|
|
3
|
-
from netaddr import IPNetwork, AddrFormatError
|
|
4
|
-
|
|
5
|
-
from django.db import migrations
|
|
6
|
-
import netbox_dns.fields.network
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def update_zone_arpa_network(apps, schema_editor):
|
|
10
|
-
Zone = apps.get_model("netbox_dns", "Zone")
|
|
11
|
-
|
|
12
|
-
for zone in Zone.objects.filter(name__endswith=".arpa"):
|
|
13
|
-
name = zone.name
|
|
14
|
-
|
|
15
|
-
if name.endswith(".in-addr.arpa"):
|
|
16
|
-
address = ".".join(reversed(name.replace(".in-addr.arpa", "").split(".")))
|
|
17
|
-
mask = len(address.split(".")) * 8
|
|
18
|
-
|
|
19
|
-
try:
|
|
20
|
-
zone.arpa_network = IPNetwork(f"{address}/{mask}")
|
|
21
|
-
except AddrFormatError:
|
|
22
|
-
zone.arpa_network = None
|
|
23
|
-
|
|
24
|
-
elif name.endswith("ip6.arpa"):
|
|
25
|
-
address = "".join(reversed(name.replace(".ip6.arpa", "").split(".")))
|
|
26
|
-
mask = len(address)
|
|
27
|
-
address = address + "0" * (32 - mask)
|
|
28
|
-
|
|
29
|
-
try:
|
|
30
|
-
zone.arpa_network = IPNetwork(
|
|
31
|
-
f"{':'.join([(address[i:i+4]) for i in range(0, mask, 4)])}::/{mask*4}"
|
|
32
|
-
)
|
|
33
|
-
except AddrFormatError:
|
|
34
|
-
zone.arpa_network = None
|
|
35
|
-
|
|
36
|
-
zone.save()
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class Migration(migrations.Migration):
|
|
40
|
-
dependencies = [
|
|
41
|
-
("netbox_dns", "0017_alter_record_ttl"),
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
operations = [
|
|
45
|
-
migrations.AddField(
|
|
46
|
-
model_name="zone",
|
|
47
|
-
name="arpa_network",
|
|
48
|
-
field=netbox_dns.fields.network.NetworkField(blank=True, null=True),
|
|
49
|
-
),
|
|
50
|
-
migrations.RunPython(update_zone_arpa_network),
|
|
51
|
-
]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from django.db import migrations
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def update_ns_ttl(apps, schema_editor):
|
|
5
|
-
Zone = apps.get_model("netbox_dns", "Zone")
|
|
6
|
-
|
|
7
|
-
for zone in Zone.objects.all():
|
|
8
|
-
for nameserver in zone.nameservers.all():
|
|
9
|
-
nameserver.ttl = None
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Migration(migrations.Migration):
|
|
13
|
-
dependencies = [
|
|
14
|
-
("netbox_dns", "0018_zone_arpa_network"),
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
operations = [
|
|
18
|
-
migrations.RunPython(update_ns_ttl),
|
|
19
|
-
]
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{% extends 'generic/object.html' %}
|
|
2
|
-
|
|
3
|
-
{% block content %}
|
|
4
|
-
<div class="row">
|
|
5
|
-
<div class="col col-md-6">
|
|
6
|
-
<div class="card">
|
|
7
|
-
<h5 class="card-header">Contact</h5>
|
|
8
|
-
<div class="card-body">
|
|
9
|
-
<table class="table table-hover attr-table">
|
|
10
|
-
<tr>
|
|
11
|
-
<th scope="row">Name</th>
|
|
12
|
-
<td>{{ object.name }}</td>
|
|
13
|
-
</tr>
|
|
14
|
-
<tr>
|
|
15
|
-
<th scope="row">Contact ID</th>
|
|
16
|
-
<td>{{ object.contact_id }}</td>
|
|
17
|
-
</tr>
|
|
18
|
-
<tr>
|
|
19
|
-
<th scope="row">Organization</th>
|
|
20
|
-
<td>{{ object.organization }}</td>
|
|
21
|
-
</tr>
|
|
22
|
-
<tr>
|
|
23
|
-
<th scope="row">Street</th>
|
|
24
|
-
<td>{{ object.street }}</td>
|
|
25
|
-
</tr>
|
|
26
|
-
<tr>
|
|
27
|
-
<th scope="row">City</th>
|
|
28
|
-
<td>{{ object.city }}</td>
|
|
29
|
-
</tr>
|
|
30
|
-
<tr>
|
|
31
|
-
<th scope="row">State/Province</th>
|
|
32
|
-
<td>{{ object.state_province }}</td>
|
|
33
|
-
</tr>
|
|
34
|
-
<tr>
|
|
35
|
-
<th scope="row">Postal Code</th>
|
|
36
|
-
<td>{{ object.postal_code }}</td>
|
|
37
|
-
</tr>
|
|
38
|
-
<tr>
|
|
39
|
-
<th scope="row">Country</th>
|
|
40
|
-
<td>{{ object.country }}</td>
|
|
41
|
-
</tr>
|
|
42
|
-
<tr>
|
|
43
|
-
<th scope="row">Phone</th>
|
|
44
|
-
<td>{{ object.phone }}</td>
|
|
45
|
-
</tr>
|
|
46
|
-
<tr>
|
|
47
|
-
<th scope="row">Phone Extension</th>
|
|
48
|
-
<td>{{ object.phone_ext }}</td>
|
|
49
|
-
</tr>
|
|
50
|
-
<tr>
|
|
51
|
-
<th scope="row">Fax</th>
|
|
52
|
-
<td>{{ object.fax }}</td>
|
|
53
|
-
</tr>
|
|
54
|
-
<tr>
|
|
55
|
-
<th scope="row">Fax Extension</th>
|
|
56
|
-
<td>{{ object.fax_ext }}</td>
|
|
57
|
-
</tr>
|
|
58
|
-
<tr>
|
|
59
|
-
<th scope="row">Email</th>
|
|
60
|
-
<td>{{ object.email }}</td>
|
|
61
|
-
</tr>
|
|
62
|
-
</table>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
{% include 'inc/panels/custom_fields.html' %}
|
|
66
|
-
</div>
|
|
67
|
-
<div class="col col-md-6">
|
|
68
|
-
{% include 'inc/panels/tags.html' %}
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
{% endblock %}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{% load helpers %}
|
|
2
|
-
|
|
3
|
-
<div class="card">
|
|
4
|
-
<h5 class="card-header">Related NetBox DNS Objects</h5>
|
|
5
|
-
<ul class="list-group list-group-flush">
|
|
6
|
-
{% for qs, filter_param in related_dns_models %}
|
|
7
|
-
{% with viewname=qs.model|viewname:"list" %}
|
|
8
|
-
<a href="{% url viewname %}?{{ filter_param }}={{ object.pk }}" class="list-group-item list-group-item-action d-flex justify-content-between">
|
|
9
|
-
{{ qs.model|meta:"verbose_name_plural"|bettertitle }}
|
|
10
|
-
{% with count=qs.count %}
|
|
11
|
-
{% if count %}
|
|
12
|
-
<span class="badge bg-primary rounded-pill">{{ count }}</span>
|
|
13
|
-
{% else %}
|
|
14
|
-
<span class="badge bg-light rounded-pill">—</span>
|
|
15
|
-
{% endif %}
|
|
16
|
-
{% endwith %}
|
|
17
|
-
</a>
|
|
18
|
-
{% endwith %}
|
|
19
|
-
{% endfor %}
|
|
20
|
-
</ul>
|
|
21
|
-
</div>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from pkg_resources import parse_version
|
|
2
|
-
from django.conf import settings
|
|
3
|
-
from django import template
|
|
4
|
-
|
|
5
|
-
register = template.Library()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
# Version check
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@register.filter()
|
|
14
|
-
def check_version(version):
|
|
15
|
-
return parse_version(settings.VERSION) < parse_version(version)
|