netbox-plugin-dns 1.2b1__py3-none-any.whl → 1.2.1__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.

Potentially problematic release.


This version of netbox-plugin-dns might be problematic. Click here for more details.

netbox_dns/__init__.py CHANGED
@@ -7,7 +7,7 @@ from ipam.choices import IPAddressStatusChoices
7
7
 
8
8
  from netbox_dns.choices import RecordTypeChoices, RecordStatusChoices, ZoneStatusChoices
9
9
 
10
- __version__ = "1.2b1"
10
+ __version__ = "1.2.1"
11
11
 
12
12
 
13
13
  def _check_list(setting):
@@ -49,9 +49,11 @@ class DNSConfig(PluginConfig):
49
49
  "dnssync_minimum_zone_labels": 2,
50
50
  "tolerate_characters_in_zone_labels": "",
51
51
  "tolerate_underscores_in_labels": False,
52
- "tolerate_underscores_in_hostnames": False, # Deprecated, will be removed in 1.2.0
53
52
  "tolerate_leading_underscore_types": [
53
+ RecordTypeChoices.CNAME,
54
+ RecordTypeChoices.DNAME,
54
55
  RecordTypeChoices.SRV,
56
+ RecordTypeChoices.SVCB,
55
57
  RecordTypeChoices.TLSA,
56
58
  RecordTypeChoices.TXT,
57
59
  ],
@@ -75,6 +75,7 @@ class RecordSerializer(NetBoxModelSerializer):
75
75
  "custom_fields",
76
76
  "tenant",
77
77
  "ipam_ip_address",
78
+ "absolute_value",
78
79
  )
79
80
  brief_fields = (
80
81
  "id",
@@ -29,20 +29,6 @@ class ZoneFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
29
29
  to_field_name="name",
30
30
  label=_("View"),
31
31
  )
32
- # DEPRECATED: Remove in 1.1
33
- name_server_id = django_filters.ModelMultipleChoiceFilter(
34
- queryset=NameServer.objects.all(),
35
- field_name="nameservers",
36
- to_field_name="id",
37
- label=_("Nameserver IDs"),
38
- )
39
- # DEPRECATED: Remove in 1.1
40
- name_server = django_filters.ModelMultipleChoiceFilter(
41
- queryset=NameServer.objects.all(),
42
- field_name="nameservers__name",
43
- to_field_name="name",
44
- label=_("Nameservers"),
45
- )
46
32
  nameserver_id = django_filters.ModelMultipleChoiceFilter(
47
33
  queryset=NameServer.objects.all(),
48
34
  field_name="nameservers",
@@ -134,6 +134,7 @@ class NetBoxDNSRecordType(NetBoxObjectType):
134
134
  zone: Annotated["NetBoxDNSZoneType", strawberry.lazy("netbox_dns.graphql.types")]
135
135
  type: str
136
136
  value: str
137
+ absolute_value: str
137
138
  status: str
138
139
  ttl: BigInt | None
139
140
  managed: bool
@@ -3,6 +3,7 @@ import netaddr
3
3
 
4
4
  import dns
5
5
  from dns import name as dns_name
6
+ from dns import rdata
6
7
 
7
8
  from django.core.exceptions import ValidationError
8
9
  from django.db import transaction, models
@@ -22,7 +23,11 @@ from netbox_dns.fields import AddressField
22
23
  from netbox_dns.utilities import arpa_to_prefix, name_to_unicode, get_query_from_filter
23
24
  from netbox_dns.validators import validate_generic_name, validate_record_value
24
25
  from netbox_dns.mixins import ObjectModificationMixin
25
- from netbox_dns.choices import RecordTypeChoices, RecordStatusChoices
26
+ from netbox_dns.choices import (
27
+ RecordTypeChoices,
28
+ RecordStatusChoices,
29
+ RecordClassChoices,
30
+ )
26
31
 
27
32
 
28
33
  __all__ = (
@@ -634,6 +639,43 @@ class Record(ObjectModificationMixin, ContactsMixin, NetBoxModel):
634
639
  }
635
640
  )
636
641
 
642
+ @property
643
+ def absolute_value(self):
644
+ zone = dns_name.from_text(self.zone.name)
645
+ rr = rdata.from_text(RecordClassChoices.IN, self.type, self.value)
646
+
647
+ match self.type:
648
+ case (
649
+ RecordTypeChoices.CNAME
650
+ | RecordTypeChoices.DNAME
651
+ | RecordTypeChoices.NS
652
+ | RecordTypeChoices.HTTPS
653
+ | RecordTypeChoices.SRV
654
+ | RecordTypeChoices.SVCB
655
+ ):
656
+ return rr.replace(target=rr.target.derelativize(zone)).to_text()
657
+
658
+ case RecordTypeChoices.MX | RecordTypeChoices.RT | RecordTypeChoices.KX:
659
+ return rr.replace(exchange=rr.exchange.derelativize(zone)).to_text()
660
+
661
+ case RecordTypeChoices.RP:
662
+ return rr.replace(
663
+ mbox=rr.mbox.derelativize(zone), txt=rr.txt.derelativize(zone)
664
+ ).to_text()
665
+
666
+ case RecordTypeChoices.NAPTR:
667
+ return rr.replace(
668
+ replacement=rr.replacement.derelativize(zone)
669
+ ).to_text()
670
+
671
+ case RecordTypeChoices.PX:
672
+ return rr.replace(
673
+ map822=rr.map822.derelativize(zone),
674
+ mapx400=rr.mapx400.derelativize(zone),
675
+ ).to_text()
676
+
677
+ return self.value
678
+
637
679
  def handle_conflicting_address_records(self):
638
680
  if self.ipam_ip_address is None or not self.is_active:
639
681
  return
@@ -7,6 +7,8 @@ from dns.exception import SyntaxError
7
7
  from django.core.exceptions import ValidationError
8
8
  from django.utils.translation import gettext as _
9
9
 
10
+ from netbox.plugins.utils import get_plugin_config
11
+
10
12
  from netbox_dns.choices import RecordClassChoices, RecordTypeChoices
11
13
  from netbox_dns.validators import (
12
14
  validate_fqdn,
@@ -76,14 +78,19 @@ def validate_record_value(record):
76
78
  ).format(value=record.value, type=record.type, error=exc)
77
79
  )
78
80
 
81
+ skip_name_validation = record.type in get_plugin_config(
82
+ "netbox_dns", "tolerate_non_rfc1035_types", default=[]
83
+ )
84
+
79
85
  match record.type:
80
86
  case RecordTypeChoices.CNAME:
81
87
  _validate_idn(rr.target)
82
- validate_domain_name(
83
- rr.target.to_text(),
84
- always_tolerant=True,
85
- allow_empty_label=True,
86
- )
88
+ if not skip_name_validation:
89
+ validate_domain_name(
90
+ rr.target.to_text(),
91
+ always_tolerant=True,
92
+ allow_empty_label=True,
93
+ )
87
94
 
88
95
  case (
89
96
  RecordTypeChoices.NS
@@ -92,38 +99,46 @@ def validate_record_value(record):
92
99
  | RecordTypeChoices.SVCB
93
100
  ):
94
101
  _validate_idn(rr.target)
95
- validate_domain_name(rr.target.to_text(), always_tolerant=True)
102
+ if not skip_name_validation:
103
+ validate_domain_name(rr.target.to_text(), always_tolerant=True)
96
104
 
97
105
  case RecordTypeChoices.DNAME:
98
106
  _validate_idn(rr.target)
99
- validate_domain_name(
100
- rr.target.to_text(), always_tolerant=True, zone_name=True
101
- )
107
+ if not skip_name_validation:
108
+ validate_domain_name(
109
+ rr.target.to_text(), always_tolerant=True, zone_name=True
110
+ )
102
111
 
103
112
  case RecordTypeChoices.PTR | RecordTypeChoices.NSAP_PTR:
104
113
  _validate_idn(rr.target)
105
- validate_fqdn(rr.target.to_text(), always_tolerant=True)
114
+ if not skip_name_validation:
115
+ validate_fqdn(rr.target.to_text(), always_tolerant=True)
106
116
 
107
117
  case RecordTypeChoices.MX | RecordTypeChoices.RT | RecordTypeChoices.KX:
108
118
  _validate_idn(rr.exchange)
109
- validate_domain_name(rr.exchange.to_text(), always_tolerant=True)
119
+ if not skip_name_validation:
120
+ validate_domain_name(rr.exchange.to_text(), always_tolerant=True)
110
121
 
111
122
  case RecordTypeChoices.NSEC:
112
123
  _validate_idn(rr.next)
113
- validate_domain_name(rr.next.to_text(), always_tolerant=True)
124
+ if not skip_name_validation:
125
+ validate_domain_name(rr.next.to_text(), always_tolerant=True)
114
126
 
115
127
  case RecordTypeChoices.RP:
116
128
  _validate_idn(rr.mbox)
117
- validate_domain_name(rr.mbox.to_text(), always_tolerant=True)
118
129
  _validate_idn(rr.txt)
119
- validate_domain_name(rr.txt.to_text(), always_tolerant=True)
130
+ if not skip_name_validation:
131
+ validate_domain_name(rr.mbox.to_text(), always_tolerant=True)
132
+ validate_domain_name(rr.txt.to_text(), always_tolerant=True)
120
133
 
121
134
  case RecordTypeChoices.NAPTR:
122
135
  _validate_idn(rr.replacement)
123
- validate_generic_name(rr.replacement.to_text(), always_tolerant=True)
136
+ if not skip_name_validation:
137
+ validate_generic_name(rr.replacement.to_text(), always_tolerant=True)
124
138
 
125
139
  case RecordTypeChoices.PX:
126
140
  _validate_idn(rr.map822)
127
- validate_domain_name(rr.map822.to_text(), always_tolerant=True)
128
141
  _validate_idn(rr.mapx400)
129
- validate_domain_name(rr.mapx400.to_text(), always_tolerant=True)
142
+ if not skip_name_validation:
143
+ validate_domain_name(rr.map822.to_text(), always_tolerant=True)
144
+ validate_domain_name(rr.mapx400.to_text(), always_tolerant=True)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: netbox-plugin-dns
3
- Version: 1.2b1
3
+ Version: 1.2.1
4
4
  Summary: NetBox DNS is a NetBox plugin for managing DNS data.
5
5
  Author-email: Peter Eckel <pete@netbox-dns.org>
6
6
  Project-URL: Homepage, https://github.com/peteeckel/netbox-plugin-dns
@@ -8,7 +8,7 @@ Project-URL: Documentation, https://github.com/peteeckel/netbox-plugin-dns/blob/
8
8
  Project-URL: Repository, https://github.com/peteeckel/netbox-plugin-dns
9
9
  Project-URL: Issues, https://github.com/peteeckel/netbox-plugin-dns/issues
10
10
  Keywords: netbox,netbox-plugin,dns
11
- Classifier: Development Status :: 4 - Beta
11
+ Classifier: Development Status :: 5 - Production/Stable
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
@@ -1,4 +1,4 @@
1
- netbox_dns/__init__.py,sha256=l39Hu_zZEZ1n15O9AzQx0Kr3s8U2EiRDyFIK91e2ErM,3000
1
+ netbox_dns/__init__.py,sha256=y1gmAAuUkeTAfa-FMptZlEVfTPn-5U2YC_Mre2RV1pE,3018
2
2
  netbox_dns/apps.py,sha256=JCW5eS-AQBUubDJve1DjP-IRFKTFGQh1NLGWzJpC5MI,151
3
3
  netbox_dns/navigation.py,sha256=36clAzlWftW94_VZ3EHu8_btzzA_dah50CLTfoov-O4,6226
4
4
  netbox_dns/template_content.py,sha256=T06L7-m4eGrLMeGsCvPpQLAGfn3S2FL7z0Cd1hhbisY,4225
@@ -10,7 +10,7 @@ netbox_dns/api/views.py,sha256=QtA5OQtIDGZoZSSaFTua1TtqARQPSVxLYy8b28CAf0s,3979
10
10
  netbox_dns/api/serializers_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  netbox_dns/api/serializers_/nameserver.py,sha256=DMkUaLNDt3UtpAD6JDHfo1NMngHWRqHh2-xQeOPlfFM,1171
12
12
  netbox_dns/api/serializers_/prefix.py,sha256=kZ1DjDly6VFZamXSxGa57YC6MfZZcI5S7jmGBkVB2_I,551
13
- netbox_dns/api/serializers_/record.py,sha256=U3B2KhblgLzfiNbMJvYBdogU-JDyVzOlXq-O2RXjVQ8,2378
13
+ netbox_dns/api/serializers_/record.py,sha256=gpfANXhAcPylFWmWpCfwSEHrYy3b9Wl07PIyM4sPKM0,2408
14
14
  netbox_dns/api/serializers_/record_template.py,sha256=WAHua_O7v8IB7QL_hOPWjItMtAjWIUZace2rebwjSJA,1519
15
15
  netbox_dns/api/serializers_/registrar.py,sha256=xLIaeBJ5ckV1Jf-uyCTFcvsLlsRMlpDtIg6q79vXZic,842
16
16
  netbox_dns/api/serializers_/registration_contact.py,sha256=3IGWW5xB9XEBGApCGZCZIxpCmy1Y5jQUbA4GzmtaCik,1024
@@ -32,7 +32,7 @@ netbox_dns/filtersets/record_template.py,sha256=wir5s2QWfDnw0M1wWnzJs9im5ok4l5cT
32
32
  netbox_dns/filtersets/registrar.py,sha256=Wh_l-IXRHnJhW7Pyokp3czQZISDKzXnWeSQKp512Drc,977
33
33
  netbox_dns/filtersets/registration_contact.py,sha256=903sOcHPRCI0dVzqn1i0pn5VPr_4YpHPh5QE2-akR-Y,1139
34
34
  netbox_dns/filtersets/view.py,sha256=IlQz3k2J_N6eSbT9op0KOu3sKLrn-HTsJCcrIqoYgyY,1047
35
- netbox_dns/filtersets/zone.py,sha256=KjF8oUOIaDkW98pw-OuGNofA4muA922wcDOx3pm6kTc,6818
35
+ netbox_dns/filtersets/zone.py,sha256=zl39SOiYIZxAi3G1wx0s9UEIgh8hG9Bdb46qIXLwMr8,6334
36
36
  netbox_dns/filtersets/zone_template.py,sha256=Sm40P33IhN0sOqtjz4JzoBbEK-dTLpfQqYGcM_Xb7KM,3870
37
37
  netbox_dns/forms/__init__.py,sha256=axENVF9vX9BtDKCNxrapRjye1NnygUg9BS0BBj6a0io,209
38
38
  netbox_dns/forms/nameserver.py,sha256=GJe3ece4yIGwMtLZ6wQihBrJu1dk_ZSiwX-vSU0fRa0,3397
@@ -46,7 +46,7 @@ netbox_dns/forms/zone_template.py,sha256=49vhM-Lc4JAGZD-al4QpPDLfwmpu82JNuX-bxpw
46
46
  netbox_dns/graphql/__init__.py,sha256=jghYD6uOSAis6YyLbtI3YJGZfwPw1uL2FBRsHs1EhNk,514
47
47
  netbox_dns/graphql/filters.py,sha256=fHCjFIwbPBJJMk2W7HI8LhrfFhCtQtCM9IE8ZMgVafc,1766
48
48
  netbox_dns/graphql/schema.py,sha256=q9DQ_hfRB0e6Znq4-IS6UEeTOfMkZmrWkwxcAql1uOA,2270
49
- netbox_dns/graphql/types.py,sha256=akSquN1AIFbGAVhofioPwVUM__B605PjNj3z4nmMl3c,8068
49
+ netbox_dns/graphql/types.py,sha256=8DjYxWOfjmS5HFW-eaQLl9E12pbg2xlWNwV5CH6ptdY,8092
50
50
  netbox_dns/locale/de/LC_MESSAGES/django.mo,sha256=0ij8AzrkWdwtUejXTOTdJJcIRweZfQT3iWjAXrf6hyM,20335
51
51
  netbox_dns/locale/en/LC_MESSAGES/django.mo,sha256=GDnSZkfHs3yjtTsll7dksEEej4B50F8pc9RGytZNubM,393
52
52
  netbox_dns/management/commands/cleanup_database.py,sha256=1-tAl0Sht80qaNZyfFyUW19Eh9gBUuc7GdbHN4aemGU,5935
@@ -82,7 +82,7 @@ netbox_dns/mixins/__init__.py,sha256=LxTEfpod_RHCyMtnzDljv0_dwqp2z3Q6tqbXW8LTGD8
82
82
  netbox_dns/mixins/object_modification.py,sha256=AR64fU5f7g-scNAj9b54eSoS9dpjyOpqrxXVXPcOhY8,1807
83
83
  netbox_dns/models/__init__.py,sha256=5Ns9RaemTe5L0L3c6a38RxembWhV-sX9cqfjl05aPQw,313
84
84
  netbox_dns/models/nameserver.py,sha256=RmUubF05_K1GMOM7e_geoxXIrS8Xbs1al_xsfwmfd0Q,3389
85
- netbox_dns/models/record.py,sha256=21jhppbRlVlHd4HJNUtitF4uES09PyvtXqCppbD9SfI,28008
85
+ netbox_dns/models/record.py,sha256=tRzkjdiGIPulzlulQdzEZetObOL_9mhIunZREux6pDg,29397
86
86
  netbox_dns/models/record_template.py,sha256=PC4369q_LIJkImp1_jhiTTwy083MXIGpGADnbDHMbqI,5104
87
87
  netbox_dns/models/registrar.py,sha256=bjgYgeUtWGg_seDRN1-VV4Pe450ZK85lbALo4J_Zuic,1890
88
88
  netbox_dns/models/registration_contact.py,sha256=AkpNy9KbFV9YrISdepqZA1ZfckZSA9u_vfPUAf5Z4H8,3773
@@ -128,7 +128,7 @@ netbox_dns/utilities/dns.py,sha256=QKST49UkCw7n2GyrN3wU5ap6Cw98t1SZxFYJlyG2x70,3
128
128
  netbox_dns/utilities/ipam_dnssync.py,sha256=tFphPVluDUS3-4NsUW1_D1dDksA3AgIozf7JAoTIE_w,9533
129
129
  netbox_dns/validators/__init__.py,sha256=Mr8TvmcJTa8Pubj8TzbFBKfbHhEmGcr5JdQvczEJ39A,72
130
130
  netbox_dns/validators/dns_name.py,sha256=D2SVUHkDAdENspDTzvW4qeWdKC_2KcueqNioqgoHrfA,3628
131
- netbox_dns/validators/dns_value.py,sha256=9zCbSLfSYEebn9brcA3Q0vVK2qnvZwlv0HxDoge6Yfs,4586
131
+ netbox_dns/validators/dns_value.py,sha256=-mc62mth-hlbPUPe_RlCR7vo1KSD6_gQDXiE8rjB-Cc,5206
132
132
  netbox_dns/validators/rfc2317.py,sha256=uKkwxpakiFFKdYA0qy8WSlEnbFwJD4MDw6gGV4F6skg,706
133
133
  netbox_dns/views/__init__.py,sha256=axENVF9vX9BtDKCNxrapRjye1NnygUg9BS0BBj6a0io,209
134
134
  netbox_dns/views/nameserver.py,sha256=2PaOHtcjaZm0FQMYTmiys-uqQsCBP_RKamW2Jj3rJOY,3896
@@ -139,8 +139,8 @@ netbox_dns/views/registration_contact.py,sha256=u__0w4Nm1_5lnAeFXfTY-cD86facWxIo
139
139
  netbox_dns/views/view.py,sha256=a6-wdMyTWoZekiR2VnM3VNSOjX-8L3Qjqqi973UobAA,3391
140
140
  netbox_dns/views/zone.py,sha256=H7UPN4T_sn_3ijvXi7t8iteJFs6qqEtVzhvchKOOzCM,7133
141
141
  netbox_dns/views/zone_template.py,sha256=vNXG96D6uZJo4KRdsgsTL3d9JzRtiDJg4_h4_3gjAfk,2667
142
- netbox_plugin_dns-1.2b1.dist-info/LICENSE,sha256=I3tDu11bZfhFm3EkV4zOD5TmWgLjnUNLEFwrdjniZYs,1112
143
- netbox_plugin_dns-1.2b1.dist-info/METADATA,sha256=h9Zr7ncCUaMmqBVt9XTUlsOI9-VjJagU4S6FUBC8yBA,7210
144
- netbox_plugin_dns-1.2b1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
145
- netbox_plugin_dns-1.2b1.dist-info/top_level.txt,sha256=sA1Rwl1mRKvMC6XHe2ylZ1GF-Q1NGd08XedK9Y4xZc4,11
146
- netbox_plugin_dns-1.2b1.dist-info/RECORD,,
142
+ netbox_plugin_dns-1.2.1.dist-info/LICENSE,sha256=I3tDu11bZfhFm3EkV4zOD5TmWgLjnUNLEFwrdjniZYs,1112
143
+ netbox_plugin_dns-1.2.1.dist-info/METADATA,sha256=GAb1unCGj5FYGlaPyeTAVUCP4Bs5BWw90ndmMzaCOeQ,7223
144
+ netbox_plugin_dns-1.2.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
145
+ netbox_plugin_dns-1.2.1.dist-info/top_level.txt,sha256=sA1Rwl1mRKvMC6XHe2ylZ1GF-Q1NGd08XedK9Y4xZc4,11
146
+ netbox_plugin_dns-1.2.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5