netbox-plugin-dns 1.0.7__py3-none-any.whl → 1.1.0__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.

Files changed (69) hide show
  1. netbox_dns/__init__.py +23 -4
  2. netbox_dns/api/serializers.py +2 -1
  3. netbox_dns/api/serializers_/prefix.py +18 -0
  4. netbox_dns/api/serializers_/{contact.py → registration_contact.py} +5 -5
  5. netbox_dns/api/serializers_/view.py +34 -2
  6. netbox_dns/api/serializers_/zone.py +5 -5
  7. netbox_dns/api/serializers_/zone_template.py +5 -5
  8. netbox_dns/api/urls.py +5 -2
  9. netbox_dns/api/views.py +17 -7
  10. netbox_dns/fields/__init__.py +1 -0
  11. netbox_dns/fields/ipam.py +15 -0
  12. netbox_dns/filtersets/__init__.py +1 -1
  13. netbox_dns/filtersets/{contact.py → registration_contact.py} +4 -4
  14. netbox_dns/filtersets/view.py +16 -0
  15. netbox_dns/filtersets/zone.py +15 -15
  16. netbox_dns/filtersets/zone_template.py +15 -15
  17. netbox_dns/forms/__init__.py +1 -1
  18. netbox_dns/forms/{contact.py → registration_contact.py} +16 -16
  19. netbox_dns/forms/view.py +204 -4
  20. netbox_dns/forms/zone.py +15 -18
  21. netbox_dns/forms/zone_template.py +13 -13
  22. netbox_dns/graphql/__init__.py +2 -2
  23. netbox_dns/graphql/filters.py +5 -5
  24. netbox_dns/graphql/schema.py +9 -5
  25. netbox_dns/graphql/types.py +41 -12
  26. netbox_dns/management/commands/rebuild_dnssync.py +18 -0
  27. netbox_dns/management/commands/setup_dnssync.py +140 -0
  28. netbox_dns/migrations/0008_view_prefixes.py +18 -0
  29. netbox_dns/migrations/0009_rename_contact_registrationcontact.py +27 -0
  30. netbox_dns/models/__init__.py +1 -3
  31. netbox_dns/models/record.py +139 -20
  32. netbox_dns/models/{contact.py → registration_contact.py} +8 -8
  33. netbox_dns/models/view.py +5 -0
  34. netbox_dns/models/zone.py +66 -30
  35. netbox_dns/models/zone_template.py +4 -4
  36. netbox_dns/navigation.py +7 -7
  37. netbox_dns/signals/ipam_dnssync.py +224 -0
  38. netbox_dns/tables/__init__.py +1 -1
  39. netbox_dns/tables/ipam_dnssync.py +11 -0
  40. netbox_dns/tables/record.py +33 -0
  41. netbox_dns/tables/{contact.py → registration_contact.py} +5 -5
  42. netbox_dns/tables/view.py +24 -2
  43. netbox_dns/template_content.py +41 -40
  44. netbox_dns/templates/netbox_dns/record.html +6 -6
  45. netbox_dns/templates/netbox_dns/{contact.html → registrationcontact.html} +1 -1
  46. netbox_dns/templates/netbox_dns/view/button.html +9 -0
  47. netbox_dns/templates/netbox_dns/view/prefix.html +41 -0
  48. netbox_dns/templates/netbox_dns/view/related.html +17 -0
  49. netbox_dns/templates/netbox_dns/view.html +25 -0
  50. netbox_dns/urls/__init__.py +2 -2
  51. netbox_dns/urls/registration_contact.py +60 -0
  52. netbox_dns/urls/view.py +6 -0
  53. netbox_dns/utilities/__init__.py +2 -74
  54. netbox_dns/utilities/conversions.py +83 -0
  55. netbox_dns/utilities/ipam_dnssync.py +295 -0
  56. netbox_dns/views/__init__.py +1 -1
  57. netbox_dns/views/record.py +3 -5
  58. netbox_dns/views/registration_contact.py +94 -0
  59. netbox_dns/views/view.py +26 -1
  60. {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0.dist-info}/METADATA +2 -1
  61. {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0.dist-info}/RECORD +63 -54
  62. netbox_dns/management/commands/setup_coupling.py +0 -109
  63. netbox_dns/signals/ipam_coupling.py +0 -168
  64. netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
  65. netbox_dns/urls/contact.py +0 -29
  66. netbox_dns/utilities/ipam_coupling.py +0 -112
  67. netbox_dns/views/contact.py +0 -94
  68. {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0.dist-info}/LICENSE +0 -0
  69. {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0.dist-info}/WHEEL +0 -0
@@ -1,50 +1,53 @@
1
- netbox_dns/__init__.py,sha256=C1P57RdYgCLvCcwjGlFzH7NSbgiSLanIFZBLehhK34w,1244
1
+ netbox_dns/__init__.py,sha256=VeKyMc8-q9rCbxO2z30AYtLZVrw6myj1JkCgBv2BjSA,1920
2
2
  netbox_dns/api/nested_serializers.py,sha256=zRIgWEtKIhvfxKOtxwFRfNeUQGWWNeuulfZ6oeFhe2w,3195
3
- netbox_dns/api/serializers.py,sha256=WNs7_Inr4veHXUHXmORBjHilrVIzSUi5zPiOCtzQZSU,335
3
+ netbox_dns/api/serializers.py,sha256=bLbAjyIsj75S9wnQAGL-wYOkTlFS1Y7OsBObAPzNJxc,383
4
4
  netbox_dns/api/serializers_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- netbox_dns/api/serializers_/contact.py,sha256=5fAdHfjBGIh4686tvgPejhW5Di46LNzIYVvAGeFDq0c,964
6
5
  netbox_dns/api/serializers_/nameserver.py,sha256=PlpVsai24O73B-ZQ4wSaSC0_m_LCtQETDRSUYDb1xGw,1118
6
+ netbox_dns/api/serializers_/prefix.py,sha256=kZ1DjDly6VFZamXSxGa57YC6MfZZcI5S7jmGBkVB2_I,551
7
7
  netbox_dns/api/serializers_/record.py,sha256=62924HonaKflFXkTgFft_624BKEikAMkak1AKDYsFvk,2316
8
8
  netbox_dns/api/serializers_/record_template.py,sha256=qh-g-_f6M-eU4GzN-l0nPxiNBpZyYBgib26HwfOMtUc,1466
9
9
  netbox_dns/api/serializers_/registrar.py,sha256=xLIaeBJ5ckV1Jf-uyCTFcvsLlsRMlpDtIg6q79vXZic,842
10
- netbox_dns/api/serializers_/view.py,sha256=tkv7KD6FJH1_AwPljx2vVJThO0Xb4OcCmlc9E8E4bhQ,950
11
- netbox_dns/api/serializers_/zone.py,sha256=ZOCNHNufPK8T9UKKjT4NcIyfb1zwG7gD6TpPTlMHi0k,4862
12
- netbox_dns/api/serializers_/zone_template.py,sha256=usx0vRsqRqHP6sqB92fQy3VTjIfjYflULTtQhQksSpk,3709
13
- netbox_dns/api/urls.py,sha256=hrqu6VnN6313DjYIOuZih-afSnedIPsSaqjcva45DiI,739
14
- netbox_dns/api/views.py,sha256=C9vA0yTTN845BFI06fclSEs5Too991ae0vrDDGzHKEI,3456
10
+ netbox_dns/api/serializers_/registration_contact.py,sha256=3IGWW5xB9XEBGApCGZCZIxpCmy1Y5jQUbA4GzmtaCik,1024
11
+ netbox_dns/api/serializers_/view.py,sha256=u5HqZtPzGCBTFCsH5GkPGsyG-oR4WIJ8XOqdWe3oUow,1723
12
+ netbox_dns/api/serializers_/zone.py,sha256=vQMKyC1Pcnvp7OjRnSZt-cMP5iae9HLuMts6_JyxrG4,4935
13
+ netbox_dns/api/serializers_/zone_template.py,sha256=itwcdMe8NxMbH95yXBJTQkzzMOWzOvzTOOHJWKfEFgg,3782
14
+ netbox_dns/api/urls.py,sha256=WXYJJvqJ25BvwyrmTY-0F6cJMrgEEdEcisGeMVWEeiY,826
15
+ netbox_dns/api/views.py,sha256=4B_mmezzONyWhEtwW_QpO8u5G3LE46mAmADbg4VD4gw,3795
15
16
  netbox_dns/apps.py,sha256=JCW5eS-AQBUubDJve1DjP-IRFKTFGQh1NLGWzJpC5MI,151
16
17
  netbox_dns/choices/__init__.py,sha256=jOVs2VGV5SVADRlqVnrFeAy26i8BIeEAbGpiX7K8bL8,42
17
18
  netbox_dns/choices/record.py,sha256=IYW_g1ZvuNX2ZlRLOkurcrdfWgcXNpi2gQzRfX5C0lY,1113
18
19
  netbox_dns/choices/zone.py,sha256=u0zt03gTkeo_und0VxaTTCh3GIFv6UxtUIhoe3VJ00A,472
19
- netbox_dns/fields/__init__.py,sha256=egA6gLQ4SPYacECcYU4Vl_P7TbzLOMRfaX6rw3k26YA,69
20
+ netbox_dns/fields/__init__.py,sha256=U1nbFIwwtvr10pp3Sk91jEZeWkVQBSJtr0BVWYgOfiA,89
20
21
  netbox_dns/fields/address.py,sha256=DJwc-z5Lg6US85gNIB_Chx7ahs1GYNswdhaXkLiK3jA,1554
22
+ netbox_dns/fields/ipam.py,sha256=wla-kBm77BpD0LNQhgRZS1RYbVois7WDqPpyQkUT02k,481
21
23
  netbox_dns/fields/network.py,sha256=FgKEm5DAe_4D7Fubtj8B4SwfU3-Z9KV7kDIzRNpBBnQ,3682
22
24
  netbox_dns/fields/rfc2317.py,sha256=24qNNLbI-SGlsKqGaLNaVk8EHFrju65YTET3O-8XgTc,2571
23
- netbox_dns/filtersets/__init__.py,sha256=zvHYWy23FFmK4vxLpoMo-OD5OQBtcTUV_HG-5LCtvQE,197
24
- netbox_dns/filtersets/contact.py,sha256=VnlNX6dyUlEbj7tz9cgRKSWQOdg7OqP32cD2IyD5hu8,1091
25
+ netbox_dns/filtersets/__init__.py,sha256=f8zJhpC3-TyK1OMgTaXmm1E6C2wUc1mNtoI6LOKkljQ,210
25
26
  netbox_dns/filtersets/nameserver.py,sha256=I7RoIUcgXyIoMrhuS0dJr8uPi0AdNj6D3G6t2oSiQ7s,1147
26
27
  netbox_dns/filtersets/record.py,sha256=Jt3RlI4MIfeY5xYkLse1y1rzmKCdmuk-CRAxxaNVYbY,3750
27
28
  netbox_dns/filtersets/record_template.py,sha256=jGSjGFEnNSoxtUd7diV8wEhw8qZclz2dKLSqyVC7Djo,1548
28
29
  netbox_dns/filtersets/registrar.py,sha256=Wh_l-IXRHnJhW7Pyokp3czQZISDKzXnWeSQKp512Drc,977
29
- netbox_dns/filtersets/view.py,sha256=IbQ6ceeUHoXKTczDhLTiwwUMNrFBNhgDzEr9zHRZT7k,552
30
- netbox_dns/filtersets/zone.py,sha256=lKEHNkg7v_y7gb07swwaUTSfx7MPKvpEl4VcxEVazYY,6594
31
- netbox_dns/filtersets/zone_template.py,sha256=P1G3NG3NFzw5lSaJErZltSSKNcC_WztTNXpU7PtS4SI,3670
32
- netbox_dns/forms/__init__.py,sha256=s41w4o77tIwmhnLjsOsg08R9m3wrlomkkfCLTVQuPzc,196
33
- netbox_dns/forms/contact.py,sha256=7BdDDqusswGolzrKpOdWvlvy_UPmm-_EN_F46fNnt9E,5332
30
+ netbox_dns/filtersets/registration_contact.py,sha256=903sOcHPRCI0dVzqn1i0pn5VPr_4YpHPh5QE2-akR-Y,1139
31
+ netbox_dns/filtersets/view.py,sha256=sGUhmyr66GY2CVXOFX2g5evDt0nbU6XPPCwptvnicHQ,993
32
+ netbox_dns/filtersets/zone.py,sha256=T6ZLAtfhZRhS5U3R6pYodhFbVr-Te8gm57aaMDHN8us,6774
33
+ netbox_dns/filtersets/zone_template.py,sha256=qWHgveEJdfr36rCuPBGvBuhwNRooFu0ud_wteisGlGc,3850
34
+ netbox_dns/forms/__init__.py,sha256=axENVF9vX9BtDKCNxrapRjye1NnygUg9BS0BBj6a0io,209
34
35
  netbox_dns/forms/nameserver.py,sha256=LHomCHmFcASobaD3Z7yhAyA24h-LrYImVMz-EUXbwK4,2836
35
36
  netbox_dns/forms/record.py,sha256=svBVAFy-egDEPLcRWkxNi_1bkabKmWgJ87pmdNt6dh4,7155
36
37
  netbox_dns/forms/record_template.py,sha256=Q77p9sExJ8Xbl-Co2Px2R0At5O3naQJwx4pnino6i2o,5573
37
38
  netbox_dns/forms/registrar.py,sha256=FMnvrcq62R3wNp_2ZUEk3v_PIav0KrWPATaJ7_9KFAo,3758
38
- netbox_dns/forms/view.py,sha256=4Uuh514WPb-9M8XOCsdqSm0ayzD2ZymnLSqFn8obSLw,2273
39
- netbox_dns/forms/zone.py,sha256=17Ii2csnYquuz7HGgaK36ZgOzWnFXFeh1IQYvWnBKC0,23537
40
- netbox_dns/forms/zone_template.py,sha256=UNykid5pRB_ydy40j2DzRlBXp3_QAOqdqxdUojKYTd4,8161
41
- netbox_dns/graphql/__init__.py,sha256=ZZSsx-VM108tB_FrcVy3uGGhtmePpkXnY5U1ytnoTvE,490
42
- netbox_dns/graphql/filters.py,sha256=6Ot_d1e7h5lVXVVBB3hyWUql94K3zsK9Tjb3RVJqluw,1706
43
- netbox_dns/graphql/schema.py,sha256=KIvBSZHcD43OScvdiCjcxk5dwa6ACiwwT9FTPSnzMYE,2312
44
- netbox_dns/graphql/types.py,sha256=q0gtXhhM_MzBb1zBzXA5gopnuL4szuzXRTTAvOhPz-Y,6025
39
+ netbox_dns/forms/registration_contact.py,sha256=WHpIRnwPD7nIDKi0-zRdv7tLUN2t_n3rmt_mZrqjfEk,5524
40
+ netbox_dns/forms/view.py,sha256=DkfZOLkCClTF-7pLMiZE8J1Z9_oxmeBiEWZ7-_yTZro,9045
41
+ netbox_dns/forms/zone.py,sha256=6NI3uiI2bXIhzPM7CTxR4pbv198xmU-QHEizy16Qb-E,23601
42
+ netbox_dns/forms/zone_template.py,sha256=D0JgQE03uQ_vR6zHkS78a5PzUziNSu1ho_mk61JTRo4,8317
43
+ netbox_dns/graphql/__init__.py,sha256=jghYD6uOSAis6YyLbtI3YJGZfwPw1uL2FBRsHs1EhNk,514
44
+ netbox_dns/graphql/filters.py,sha256=fHCjFIwbPBJJMk2W7HI8LhrfFhCtQtCM9IE8ZMgVafc,1766
45
+ netbox_dns/graphql/schema.py,sha256=z_56Co3d-cmswmnY8MeOryLOGZEGK4WwYW9eekNuYRw,2430
46
+ netbox_dns/graphql/types.py,sha256=W8uKiJrPCu1vnRbG4dj4pAaNiE5Nvnt0mmWCrSoXm68,6652
45
47
  netbox_dns/management/commands/cleanup_database.py,sha256=kfnyybudwKGigjJmrOwafPWSUasZr9jQsxN4eWAgMvY,5969
46
48
  netbox_dns/management/commands/cleanup_rrset_ttl.py,sha256=UFRURLBcFeGHUS2lrYFv7UWIebjI72aG1EUQJt0XsXw,2046
47
- netbox_dns/management/commands/setup_coupling.py,sha256=1cUxDvHoX1UebgyCsbrLqIccuXhE8tkvyhW8dofIyr4,4556
49
+ netbox_dns/management/commands/rebuild_dnssync.py,sha256=56YGEsAO_NYCXRmuL9Ju_Ni3FLtMD0MO4ObZAAPefLk,617
50
+ netbox_dns/management/commands/setup_dnssync.py,sha256=qtVj6egSjclaQbuI60hLfl-zg89VJVbX-TB17f1k77Y,5730
48
51
  netbox_dns/management/commands/update_soa.py,sha256=Rj_Xk-qpwkAVRubVnM5OqSTwgzi93E0PqjwGb3rYjf0,660
49
52
  netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py,sha256=3U0810NWSHPu2dTSHpfzlleDgwMS04FhJ_CkO76SDaw,10283
50
53
  netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py,sha256=ML6Hp17lrXiaG0eUlBjKMm6HUNhw0AHPnKrb9AN-F6E,20279
@@ -54,6 +57,8 @@ netbox_dns/migrations/0004_create_and_assign_default_view.py,sha256=npBFxWuJCZeM
54
57
  netbox_dns/migrations/0005_alter_zone_view_not_null.py,sha256=vUfCFD-qeh5M1WCqtE1eYHXZwQVCcf841Z2-0CdcMRI,463
55
58
  netbox_dns/migrations/0006_templating.py,sha256=7MOZ2bLwkjK1BQCBPBaFWJ-mS_JNrok1XUSh4rriq9Y,6271
56
59
  netbox_dns/migrations/0007_alter_ordering_options.py,sha256=IDGgxEWOaSs9_WKJK1C_5_6M1uJtYscn3Vco0UHAol8,639
60
+ netbox_dns/migrations/0008_view_prefixes.py,sha256=LInzrOXTflGd2WUmyXZtjEegg7S_KBNvrbdo3jE28fE,472
61
+ netbox_dns/migrations/0009_rename_contact_registrationcontact.py,sha256=GPRERHZYEnsThVmV92YXqcaKQx942uYGiI_x5XFWofE,893
57
62
  netbox_dns/migrations/0020_netbox_3_4.py,sha256=UMcHdn8ZAuQjUaM_3rEGpktYrM0TuvhccD7Jt7WQnPs,1271
58
63
  netbox_dns/migrations/0021_record_ip_address.py,sha256=EqdhWXmq7aiK4X79xTRUZng3zFncCl-8JoO65HqlJKw,3244
59
64
  netbox_dns/migrations/0022_search.py,sha256=KW1ffEZ4-0dppGQ_KD1EN7iw8eQJOnDco-xfJFRZqKQ,172
@@ -67,37 +72,40 @@ netbox_dns/migrations/0029_record_fqdn.py,sha256=UAAU38ekKQyiYDOJlcrz6Qbk4bqZfSH
67
72
  netbox_dns/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
73
  netbox_dns/mixins/__init__.py,sha256=LxTEfpod_RHCyMtnzDljv0_dwqp2z3Q6tqbXW8LTGD8,35
69
74
  netbox_dns/mixins/object_modification.py,sha256=JbGi8a52wkZ3fFBlfat590CfqRJcEWxBsxSeTIx3Qtg,833
70
- netbox_dns/models/__init__.py,sha256=0JSjJ_F0KR66DDV8emCPlHMQwgghi9tWo_0PuvyWpQQ,346
71
- netbox_dns/models/contact.py,sha256=uBy-8_fIp_6Un9E3NsjJTIpARfATUF7uPghdSIRIHiA,3119
75
+ netbox_dns/models/__init__.py,sha256=5Ns9RaemTe5L0L3c6a38RxembWhV-sX9cqfjl05aPQw,313
72
76
  netbox_dns/models/nameserver.py,sha256=gvQRcTOVHRiX_rcBZfjNV6rTRKNJtA5HxgggYEgITPA,3296
73
- netbox_dns/models/record.py,sha256=CLNfROjxbCwAF9H4sHwBKTfCYCvV7BFt154brSOtrqo,22991
77
+ netbox_dns/models/record.py,sha256=O8w6PtuUIaFyrZg1ghIe-ZSrdQ9snBEmOeiSlR5mBPQ,26454
74
78
  netbox_dns/models/record_template.py,sha256=pyzrtk-VFEHf9hrWTW6pwPKo2AH5cEKR0XI4ZG9nVHk,4753
75
79
  netbox_dns/models/registrar.py,sha256=zCSVa6NSN9sRJzvvuSUNK4LcHBbe0OvEiTbIcrrdk9k,1671
76
- netbox_dns/models/view.py,sha256=PtuO61vzcaqRvPRsHV72dvKkerQH7vp803MK9BvUnj4,2897
77
- netbox_dns/models/zone.py,sha256=UzwyByJGumkGF--g2wxGKEZ2UZGZ_QrrpmHgpITbgxY,28438
78
- netbox_dns/models/zone_template.py,sha256=kUSGb5Sc9GultId61bjgNMyaOjRReOqvVNje5APKZvM,3841
79
- netbox_dns/navigation.py,sha256=EITDZkbpu4KCC9u4Noj7OORWnkL3EYT2RIRvYlTw34Q,5961
80
+ netbox_dns/models/registration_contact.py,sha256=v5BxTtGPrR22TyqIQkgaSH26ozhzIVrkU-PuezHki-g,3217
81
+ netbox_dns/models/view.py,sha256=hSvbb-xc7r3AyTvuxvCnWGqG7gpTkeO_FsZoHXCVMzY,3029
82
+ netbox_dns/models/zone.py,sha256=Xvg4gkskh5s6FlrA4AoAPB8aQ_Z5fBaXd8ACtgaFuEI,29598
83
+ netbox_dns/models/zone_template.py,sha256=LvNqUi_Ucj3zHb9b778kFM2EZ1s9aXp980Et5g7lvTY,3889
84
+ netbox_dns/navigation.py,sha256=YAEfmqoNRSXLSf-n3HLImDXbAfzcRdCh57BVnofmWPQ,6046
80
85
  netbox_dns/signals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
- netbox_dns/signals/ipam_coupling.py,sha256=kJUKHUgq5XgWMhxB-312SPaZAYTLIYGgKO0lz2-z_rg,5594
82
- netbox_dns/tables/__init__.py,sha256=s41w4o77tIwmhnLjsOsg08R9m3wrlomkkfCLTVQuPzc,196
83
- netbox_dns/tables/contact.py,sha256=Kukb3aT_qnxuklLodXFk6J4C8O5jBfK3BGSJjaScNa8,778
86
+ netbox_dns/signals/ipam_dnssync.py,sha256=ToGg2Z_L3wvM6gNHX-oU8QTEkbrsXuVt7J6IcQbGb9A,7964
87
+ netbox_dns/tables/__init__.py,sha256=axENVF9vX9BtDKCNxrapRjye1NnygUg9BS0BBj6a0io,209
88
+ netbox_dns/tables/ipam_dnssync.py,sha256=7gxf6nXn2zgpnpCr5E5qebXv7QCzrgIqfSzyka53USU,272
84
89
  netbox_dns/tables/nameserver.py,sha256=GGi8x8QXbrFoFjxueL1zd5L-hDZwXGs1PcLZ2DyI4JI,652
85
- netbox_dns/tables/record.py,sha256=0_EUQp5kbqWeWalH_PeMzU-0_3nVoNNv1IX6xGMiXIA,2743
90
+ netbox_dns/tables/record.py,sha256=Rcl2Iea37jFRURAExlURrVZD1XxRvQdskdh93Mn7aOs,3797
86
91
  netbox_dns/tables/record_template.py,sha256=CcXvyGycwp16ZwQFdmdt5W5Tlt__i1sBi3mixVvht3E,1763
87
92
  netbox_dns/tables/registrar.py,sha256=Vtl3RKjhWzUDv4wAfjbNV1prZHf6SyGYmSS0XKccI9g,640
88
- netbox_dns/tables/view.py,sha256=dpk9wcd0K1PdUJgfFRbL_iFBUgE2OJP9rb_suu_T8ao,586
93
+ netbox_dns/tables/registration_contact.py,sha256=xUszp7_vbZ79KHewBZkSyxNcWE3W3o8O6Pp0N-8VDXg,838
94
+ netbox_dns/tables/view.py,sha256=w6tq_zDXGf1-MVmoCoZEuPajiuH_rccRH5eU5eurQ_s,1038
89
95
  netbox_dns/tables/zone.py,sha256=bVi4sLFdw61kfIiRJnoJOtgkVGGlTZcogw-cAzFtAEQ,1507
90
96
  netbox_dns/tables/zone_template.py,sha256=gezSSpbNkiHnstNq470OsTmkl13foFXTGx-NH8W87Hw,1204
91
- netbox_dns/template_content.py,sha256=jPOnKC8rbDEm169PoIys5NKCN36uUPH4_6NwR0oZ7N8,3654
92
- netbox_dns/templates/netbox_dns/contact.html,sha256=fMHAQyLXIxohKoCTxFEnKetl9UVXeQgjasfpv_JONaw,2855
97
+ netbox_dns/template_content.py,sha256=YzE-ZJlERhFybrUKJrmNwHk8_8RPNexkV66x62Sbzic,3718
93
98
  netbox_dns/templates/netbox_dns/nameserver.html,sha256=DpTdetQVV_jKThDbi62LvbhiCay-1QxR-yiJEiPFm4w,1554
94
99
  netbox_dns/templates/netbox_dns/record/managed.html,sha256=G6LPG1koUGuzUiwYdv1okdVa4sKaofiQegDBnsFL0kA,89
95
100
  netbox_dns/templates/netbox_dns/record/related.html,sha256=Aqor8uGcuHQTHjlX-Xmni2Yp4N7lOBrMOqQiszrQOC0,742
96
- netbox_dns/templates/netbox_dns/record.html,sha256=WtEkWy_CstGWE9UDFsATxz0bNpP_Gx9joZusAYGHDFQ,5235
101
+ netbox_dns/templates/netbox_dns/record.html,sha256=o3z_D6Fqqn7nx1IwPXKQ75ZaPhU6kae0WpaWa3UMcxQ,5211
97
102
  netbox_dns/templates/netbox_dns/recordtemplate.html,sha256=9tkXtKqa5p3LdOU9REm99WSFwGJaH8OczpIqXZuXMcg,3099
98
103
  netbox_dns/templates/netbox_dns/registrar.html,sha256=O5veGmW59Pf5yN25ihPLvRIkA2P7xmSGv0G3NrRG8vI,2152
99
- netbox_dns/templates/netbox_dns/related_dns_objects.html,sha256=KSzlnw1cStrJa3poKkwrt_ycIH0oH0STWIHRNy3ks4g,806
100
- netbox_dns/templates/netbox_dns/view.html,sha256=XCa7Sg8fjSkhVqjLvw652FINQdWURLWdQqw8is82iaI,1499
104
+ netbox_dns/templates/netbox_dns/registrationcontact.html,sha256=4I3I7G38bIOVifoqgGMyPTAhD0UaD8ZCnXK7Fu9K9VQ,2868
105
+ netbox_dns/templates/netbox_dns/view/button.html,sha256=oXKNyPtY8XIu2sxtZWpFRXKXv862407ESyUQ4YsWCGE,292
106
+ netbox_dns/templates/netbox_dns/view/prefix.html,sha256=HD8f4mnbzFOXDj3Y_yq8yEeDpz_yFud8ZMpqbxzCEnA,1445
107
+ netbox_dns/templates/netbox_dns/view/related.html,sha256=W9Ie2aOsFkWyYtBnZn38seQDBmyJkV9dqFDG-Dq3yMk,736
108
+ netbox_dns/templates/netbox_dns/view.html,sha256=zqf42FGdNudoIIWCaCe9bmP_VOZDbv3GjS-qJNMKPVY,2479
101
109
  netbox_dns/templates/netbox_dns/zone/base.html,sha256=n_E4aVYdGeZZl-ARE8sb4DgAAgPs92X1UEFepX3xIlM,495
102
110
  netbox_dns/templates/netbox_dns/zone/child.html,sha256=kH56PJFBGCjiRdIh7zCtClnZdfOChqN_sYslsyoz5gU,2147
103
111
  netbox_dns/templates/netbox_dns/zone/child_zone.html,sha256=b9CSGWEfWT7hLQ80gApMnu7mXM8w2LT-3UaOYe6HIRQ,510
@@ -107,31 +115,32 @@ netbox_dns/templates/netbox_dns/zone/registration.html,sha256=de2Kph-G8Gv5LD_Wf2
107
115
  netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html,sha256=rWlmb3zRQbLYQ_1dsa0twwu6y1dRj2tfFVEERH07p-s,517
108
116
  netbox_dns/templates/netbox_dns/zone.html,sha256=zPi1sLFnya-ytx8-Pcf_ujc1sKllCRuz48x2E-S1HSo,6285
109
117
  netbox_dns/templates/netbox_dns/zonetemplate.html,sha256=qjUWqrg4uDaIFt9-g0OBxTi86i_ctf2Ps4qHh11djQE,3081
110
- netbox_dns/urls/__init__.py,sha256=FDauSMt7a01YJR8_RWkk0-kSmIL2lr1bHF0OU5ROuQ8,610
111
- netbox_dns/urls/contact.py,sha256=jVBXgWxHosqASoAT3UE6bcsasQVDKG1e4g5K_SlbzjE,1067
118
+ netbox_dns/urls/__init__.py,sha256=AhZrz9E8JkZU_uRYYa3hFueAocsT-UYfOMZOfvosvR4,647
112
119
  netbox_dns/urls/nameserver.py,sha256=-arhTF-q_h6IqcZ-CHD4GbBNCxltwRP-RoLY34KWITA,1294
113
120
  netbox_dns/urls/record.py,sha256=5HnwrsQKbB3jcCfUSwrArItTYsKBTQaa8WiRt7SBniI,1136
114
121
  netbox_dns/urls/record_template.py,sha256=kRAaienuN89WrOZGEcH1eZtiVlNsxsbZ1sjxWGxLKa0,1514
115
122
  netbox_dns/urls/registrar.py,sha256=qhf_Qh4CYKmKYNoFIkuJxVtq1V0PMDYmqXq7olB0zfg,1211
116
- netbox_dns/urls/view.py,sha256=_Urbxd1ZLC4dcb0x23ui2L0XaY8RJKKnDQtJETS-S-Q,937
123
+ netbox_dns/urls/registration_contact.py,sha256=hS9xzBN1jsHkGJzTYEpoCFZdXSbQx0yJpelB5SK4xq8,1718
124
+ netbox_dns/urls/view.py,sha256=pz-0iP_vGFUvrzIeOjq5Ebkmnaci8c4_5b2L0gYZvUE,1088
117
125
  netbox_dns/urls/zone.py,sha256=EzZ_U5v9NfWB5TVAc0i35EI-SVyXl6KrI844sMT0x5Q,937
118
126
  netbox_dns/urls/zone_template.py,sha256=nGrIaincQxCabUsLJL9JODoeTToMRSPllm7kuiPzeII,1378
119
- netbox_dns/utilities/__init__.py,sha256=-6-qmb1yTAt9QEtGtokNFBQV_TSheobkLjbWFKEYpfw,1849
120
- netbox_dns/utilities/ipam_coupling.py,sha256=0XA5kmh2CzbhuhZmQuquNh4vPXBh20TVCA2RlM4pQdQ,3471
127
+ netbox_dns/utilities/__init__.py,sha256=mmR0JdH1DJVhUKesnO3CZFj0Rw_wrsMPoYTpOOKHl9I,55
128
+ netbox_dns/utilities/conversions.py,sha256=NS37SoMqXc13wNWRkKnLfyQbVi6QKD33fu5ovTKRo74,1979
129
+ netbox_dns/utilities/ipam_dnssync.py,sha256=nopMJ3So1OjD0RDkbinnLLtR-8OHIlrh-0WtDHSZKRY,8622
121
130
  netbox_dns/validators/__init__.py,sha256=Mr8TvmcJTa8Pubj8TzbFBKfbHhEmGcr5JdQvczEJ39A,72
122
131
  netbox_dns/validators/dns_name.py,sha256=4JojiP6pb1Z1m_PmDv4g65Ckhg5rQkVqm8JAwHW28nA,3432
123
132
  netbox_dns/validators/dns_value.py,sha256=y2Zga4hmywqDrTBXcMC-sWaFbw4eoY8pySq7cWnMP8Y,2822
124
133
  netbox_dns/validators/rfc2317.py,sha256=ivylEiNKlmX2x41rwqDrFkD5CFf9FtpNEfsKHX_prbE,585
125
- netbox_dns/views/__init__.py,sha256=s41w4o77tIwmhnLjsOsg08R9m3wrlomkkfCLTVQuPzc,196
126
- netbox_dns/views/contact.py,sha256=kQDm_PHxBFDyAXf7rZdEyVdZyNNxpIvWy63qbUJZbjY,2444
134
+ netbox_dns/views/__init__.py,sha256=axENVF9vX9BtDKCNxrapRjye1NnygUg9BS0BBj6a0io,209
127
135
  netbox_dns/views/nameserver.py,sha256=CeZsKTciW85LFX9tMaGkiW1DUDT77jghtHnPCHFTAP8,3405
128
- netbox_dns/views/record.py,sha256=YpVkC6Q3rUG9F_p1dqg35o3PsST_h5hPvsB5RIsaCb4,4808
136
+ netbox_dns/views/record.py,sha256=fNpmSLH9kAaBMtsFy28bRIPRF8DMSBUPh1XlrYhYM9U,4781
129
137
  netbox_dns/views/record_template.py,sha256=amYQc8dEwjI8msTSukcq4FwVqKF9eHSlaMBOFkHe0CE,2510
130
138
  netbox_dns/views/registrar.py,sha256=ICaX9weZugWJXyRBjpHM5vD3Yz0hnhKKgb5e5DZf6zI,2295
131
- netbox_dns/views/view.py,sha256=gPC9itG3TbihYtuAIGdbu-OwIvrIkswTdre8-ZfhQF4,2247
139
+ netbox_dns/views/registration_contact.py,sha256=Yg4gTldQQPfAFgjD7vultw3OmcovWZtiNsUPyT22PiQ,2972
140
+ netbox_dns/views/view.py,sha256=-qdpEVrAI_fquZa-_jW2FvNXmCt3yRHIrkfgKKi01hc,2899
132
141
  netbox_dns/views/zone.py,sha256=Na286tp_XcnT-4FIgXsvh1wPByir0RtBil0B2JhfuZE,5495
133
142
  netbox_dns/views/zone_template.py,sha256=UaPEReBFoJP1k7MC8jS-iT3KQtJqSFu67jjCRiTCH4c,2118
134
- netbox_plugin_dns-1.0.7.dist-info/LICENSE,sha256=I3tDu11bZfhFm3EkV4zOD5TmWgLjnUNLEFwrdjniZYs,1112
135
- netbox_plugin_dns-1.0.7.dist-info/METADATA,sha256=dRqfwe0fVecsErbyt7WaVRG3w960ld1GgdWN6gRhYQA,6404
136
- netbox_plugin_dns-1.0.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
137
- netbox_plugin_dns-1.0.7.dist-info/RECORD,,
143
+ netbox_plugin_dns-1.1.0.dist-info/LICENSE,sha256=I3tDu11bZfhFm3EkV4zOD5TmWgLjnUNLEFwrdjniZYs,1112
144
+ netbox_plugin_dns-1.1.0.dist-info/METADATA,sha256=akPhzYzccwtnUBd2peusrqZiBfMKAQlNk1JD-2amaJE,6723
145
+ netbox_plugin_dns-1.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
146
+ netbox_plugin_dns-1.1.0.dist-info/RECORD,,
@@ -1,109 +0,0 @@
1
- from django.core.management.base import BaseCommand
2
-
3
- from core.models import ObjectType
4
- from extras.models import CustomField
5
- from extras.choices import CustomFieldTypeChoices
6
- from ipam.models import IPAddress
7
- from netbox_dns.models import Zone
8
-
9
-
10
- class Command(BaseCommand):
11
- help = "Setup IPAddress custom fields needed for IPAM-DNS coupling"
12
-
13
- def add_arguments(self, parser):
14
- parser.add_argument(
15
- "--remove", action="store_true", help="Remove custom fields"
16
- )
17
- parser.add_argument("--verbose", action="store_true", help="Verbose output")
18
-
19
- def handle(self, *model_names, **options):
20
- ipaddress_object_type = ObjectType.objects.get_for_model(IPAddress)
21
-
22
- if options["remove"]:
23
- for cf in (
24
- "ipaddress_dns_record_name",
25
- "ipaddress_dns_record_ttl",
26
- "ipaddress_dns_record_disable_ptr",
27
- "ipaddress_dns_zone_id",
28
- ):
29
- try:
30
- CustomField.objects.get(
31
- name=cf, object_types=ipaddress_object_type
32
- ).delete()
33
- if options.get("verbose"):
34
- self.stdout.write(f"Custom field '{cf}' removed")
35
- except CustomField.DoesNotExist:
36
- pass
37
-
38
- else:
39
- if not CustomField.objects.filter(
40
- name="ipaddress_dns_record_name",
41
- type=CustomFieldTypeChoices.TYPE_TEXT,
42
- object_types=ipaddress_object_type,
43
- ).exists():
44
- cf_name = CustomField.objects.create(
45
- name="ipaddress_dns_record_name",
46
- label="Name",
47
- type=CustomFieldTypeChoices.TYPE_TEXT,
48
- required=False,
49
- group_name="DNS",
50
- )
51
- cf_name.object_types.set([ipaddress_object_type])
52
- if options.get("verbose"):
53
- self.stdout.write(
54
- "Created custom field 'ipaddress_dns_record_name'"
55
- )
56
-
57
- if not CustomField.objects.filter(
58
- name="ipaddress_dns_record_ttl",
59
- type=CustomFieldTypeChoices.TYPE_INTEGER,
60
- object_types=ipaddress_object_type,
61
- ).exists():
62
- cf_ttl = CustomField.objects.create(
63
- name="ipaddress_dns_record_ttl",
64
- label="TTL",
65
- type=CustomFieldTypeChoices.TYPE_INTEGER,
66
- validation_minimum=0,
67
- validation_maximum=2147483647,
68
- required=False,
69
- group_name="DNS",
70
- )
71
- cf_ttl.object_types.set([ipaddress_object_type])
72
- if options.get("verbose"):
73
- self.stdout.write("Created custom field 'ipaddress_dns_record_ttl'")
74
-
75
- if not CustomField.objects.filter(
76
- name="ipaddress_dns_record_disable_ptr",
77
- type=CustomFieldTypeChoices.TYPE_BOOLEAN,
78
- object_types=ipaddress_object_type,
79
- ).exists():
80
- cf_disable_ptr = CustomField.objects.create(
81
- name="ipaddress_dns_record_disable_ptr",
82
- label="Disable PTR",
83
- type=CustomFieldTypeChoices.TYPE_BOOLEAN,
84
- required=False,
85
- default=False,
86
- group_name="DNS",
87
- )
88
- cf_disable_ptr.object_types.set([ipaddress_object_type])
89
- if options.get("verbose"):
90
- self.stdout.write(
91
- "Created custom field 'ipaddress_dns_record_disable_ptr'"
92
- )
93
-
94
- if not CustomField.objects.filter(
95
- name="ipaddress_dns_zone_id",
96
- type=CustomFieldTypeChoices.TYPE_OBJECT,
97
- object_types=ipaddress_object_type,
98
- ).exists():
99
- cf_zone = CustomField.objects.create(
100
- name="ipaddress_dns_zone_id",
101
- label="Zone",
102
- type=CustomFieldTypeChoices.TYPE_OBJECT,
103
- related_object_type=ObjectType.objects.get_for_model(Zone),
104
- required=False,
105
- group_name="DNS",
106
- )
107
- cf_zone.object_types.set([ipaddress_object_type])
108
- if options.get("verbose"):
109
- self.stdout.write("Created custom field 'ipaddress_dns_zone_id'")
@@ -1,168 +0,0 @@
1
- from django.dispatch import receiver
2
- from django.db.models.signals import pre_save, post_save, pre_delete
3
- from django.core.exceptions import ValidationError, PermissionDenied
4
- from rest_framework.exceptions import PermissionDenied as APIPermissionDenied
5
-
6
- from netbox.signals import post_clean
7
- from netbox.context import current_request
8
- from netbox.plugins.utils import get_plugin_config
9
- from ipam.models import IPAddress
10
-
11
- from netbox_dns.models import Zone
12
- from netbox_dns.utilities.ipam_coupling import (
13
- ipaddress_cf_data,
14
- get_address_record,
15
- new_address_record,
16
- update_address_record,
17
- check_permission,
18
- dns_changed,
19
- DNSPermissionDenied,
20
- )
21
-
22
-
23
- @receiver(post_clean, sender=IPAddress)
24
- def ip_address_check_permissions_save(instance, **kwargs):
25
- if not instance.address:
26
- return
27
-
28
- if not get_plugin_config("netbox_dns", "feature_ipam_coupling"):
29
- return
30
-
31
- request = current_request.get()
32
- if request is None:
33
- return
34
-
35
- try:
36
- if instance.pk is None:
37
- record = new_address_record(instance)
38
- if record is not None:
39
- record.full_clean()
40
- check_permission(request, "netbox_dns.add_record", record)
41
-
42
- else:
43
- if not dns_changed(IPAddress.objects.get(pk=instance.pk), instance):
44
- return
45
-
46
- record = get_address_record(instance)
47
- if record is not None:
48
- name, ttl, disable_ptr, zone_id = ipaddress_cf_data(instance)
49
- if zone_id is not None:
50
- update_address_record(record, instance)
51
- record.full_clean()
52
- check_permission(request, "netbox_dns.change_record", record)
53
- else:
54
- check_permission(request, "netbox_dns.delete_record", record)
55
-
56
- else:
57
- record = new_address_record(instance)
58
- if record is not None:
59
- record.full_clean()
60
- check_permission(request, "netbox_dns.add_record", record)
61
-
62
- except ValidationError as exc:
63
- if hasattr(exc, "error_dict"):
64
- value = exc.error_dict.pop("name", None)
65
- if value is not None:
66
- exc.error_dict["cf_ipaddress_dns_record_name"] = value
67
-
68
- value = exc.error_dict.pop("ttl", None)
69
- if value is not None:
70
- exc.error_dict["cf_ipaddress_dns_record_ttl"] = value
71
-
72
- value = exc.error_dict.pop("value", None)
73
- if value is not None:
74
- exc.error_dict["cf_ipaddress_dns_record_name"] = value
75
-
76
- value = exc.error_dict.pop("type", None)
77
- if value is not None:
78
- exc.error_dict["cf_ipaddress_dns_record_name"] = value
79
-
80
- raise ValidationError(exc)
81
-
82
- except DNSPermissionDenied as exc:
83
- raise ValidationError(exc)
84
-
85
-
86
- @receiver(pre_delete, sender=IPAddress)
87
- def ip_address_delete_address_record(instance, **kwargs):
88
- if not get_plugin_config("netbox_dns", "feature_ipam_coupling"):
89
- return
90
-
91
- request = current_request.get()
92
- if request is not None:
93
- try:
94
- for record in instance.netbox_dns_records.all():
95
- check_permission(request, "netbox_dns.delete_record", record)
96
-
97
- except DNSPermissionDenied as exc:
98
- if request.path_info.startswith("/api/"):
99
- raise APIPermissionDenied(exc) from None
100
-
101
- raise PermissionDenied(exc) from None
102
-
103
- for record in instance.netbox_dns_records.all():
104
- record.delete()
105
-
106
-
107
- #
108
- # Update DNS related fields according to the contents of the IPAM-DNS
109
- # coupling custom fields.
110
- #
111
- @receiver(pre_save, sender=IPAddress)
112
- def ip_address_update_dns_information(instance, **kwargs):
113
- if not get_plugin_config("netbox_dns", "feature_ipam_coupling"):
114
- return
115
-
116
- name, ttl, disable_ptr, zone_id = ipaddress_cf_data(instance)
117
-
118
- previous_zone_id = None
119
- if instance.pk is not None:
120
- try:
121
- old_instance = IPAddress.objects.get(pk=instance.pk)
122
- previous_zone_id = old_instance.custom_field_data.get(
123
- "ipaddress_dns_zone_id"
124
- )
125
- except IPAddress.DoesNotExist:
126
- pass
127
-
128
- if zone_id is not None:
129
- instance.dns_name = f"{name}.{Zone.objects.get(pk=zone_id).name}"
130
- else:
131
- instance.custom_field_data["ipaddress_dns_record_name"] = None
132
- instance.custom_field_data["ipaddress_dns_record_ttl"] = None
133
- instance.custom_field_data["ipaddress_dns_record_disable_ptr"] = False
134
- instance.custom_field_data["ipaddress_dns_zone_id"] = None
135
-
136
- if previous_zone_id is not None:
137
- instance.dns_name = ""
138
-
139
-
140
- #
141
- # Handle DNS record operation after IPAddress has been created or modified
142
- #
143
- @receiver(post_save, sender=IPAddress)
144
- def ip_address_update_address_record(instance, **kwargs):
145
- if not get_plugin_config("netbox_dns", "feature_ipam_coupling"):
146
- return
147
-
148
- name, ttl, disable_ptr, zone_id = ipaddress_cf_data(instance)
149
-
150
- if zone_id is None:
151
- #
152
- # Name/Zone CF data has been removed: Remove the DNS address record
153
- #
154
- for record in instance.netbox_dns_records.all():
155
- record.delete()
156
-
157
- else:
158
- #
159
- # Name/Zone CF data is present: Check for a DNS address record and add
160
- # or modify it as necessary
161
- #
162
- record = get_address_record(instance)
163
- if record is None:
164
- record = new_address_record(instance)
165
- else:
166
- update_address_record(record, instance)
167
-
168
- record.save()
@@ -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">&mdash;</span>
15
- {% endif %}
16
- {% endwith %}
17
- </a>
18
- {% endwith %}
19
- {% endfor %}
20
- </ul>
21
- </div>
@@ -1,29 +0,0 @@
1
- from django.urls import include, path
2
-
3
- from utilities.urls import get_model_urls
4
-
5
- from netbox_dns.views import (
6
- ContactView,
7
- ContactListView,
8
- ContactEditView,
9
- ContactDeleteView,
10
- ContactBulkImportView,
11
- ContactBulkEditView,
12
- ContactBulkDeleteView,
13
- )
14
-
15
- contact_urlpatterns = [
16
- path("contacts/<int:pk>/", ContactView.as_view(), name="contact"),
17
- path("contacts/", ContactListView.as_view(), name="contact_list"),
18
- path("contacts/add/", ContactEditView.as_view(), name="contact_add"),
19
- path("contacts/<int:pk>/edit/", ContactEditView.as_view(), name="contact_edit"),
20
- path(
21
- "contacts/<int:pk>/delete/", ContactDeleteView.as_view(), name="contact_delete"
22
- ),
23
- path("contacts/import/", ContactBulkImportView.as_view(), name="contact_import"),
24
- path("contacts/edit/", ContactBulkEditView.as_view(), name="contact_bulk_edit"),
25
- path(
26
- "contacts/delete/", ContactBulkDeleteView.as_view(), name="contact_bulk_delete"
27
- ),
28
- path("contacts/<int:pk>/", include(get_model_urls("netbox_dns", "contact"))),
29
- ]
@@ -1,112 +0,0 @@
1
- from ipam.choices import IPAddressStatusChoices
2
- from utilities.permissions import resolve_permission
3
-
4
- from netbox_dns.models import Record
5
- from netbox_dns.choices import RecordTypeChoices, RecordStatusChoices
6
-
7
- from netbox.plugins.utils import get_plugin_config
8
-
9
-
10
- class DNSPermissionDenied(Exception):
11
- pass
12
-
13
-
14
- def ipaddress_cf_data(ip_address):
15
- name = ip_address.custom_field_data.get("ipaddress_dns_record_name")
16
- ttl = ip_address.custom_field_data.get("ipaddress_dns_record_ttl")
17
- disable_ptr = ip_address.custom_field_data.get("ipaddress_dns_record_disable_ptr")
18
- if disable_ptr is None:
19
- disable_ptr = False
20
- zone_id = ip_address.custom_field_data.get("ipaddress_dns_zone_id")
21
-
22
- if name is None or zone_id is None:
23
- return None, None, False, None
24
-
25
- return name, ttl, disable_ptr, zone_id
26
-
27
-
28
- def address_record_type(ip_address):
29
- return RecordTypeChoices.AAAA if ip_address.family == 6 else RecordTypeChoices.A
30
-
31
-
32
- def address_record_status(ip_address):
33
- ip_active_status_list = get_plugin_config(
34
- "netbox_dns",
35
- "ipam_coupling_ip_active_status_list",
36
- (
37
- IPAddressStatusChoices.STATUS_ACTIVE,
38
- IPAddressStatusChoices.STATUS_DHCP,
39
- IPAddressStatusChoices.STATUS_SLAAC,
40
- ),
41
- )
42
-
43
- return (
44
- RecordStatusChoices.STATUS_ACTIVE
45
- if ip_address.status in ip_active_status_list
46
- else RecordStatusChoices.STATUS_INACTIVE
47
- )
48
-
49
-
50
- def get_address_record(ip_address):
51
- return ip_address.netbox_dns_records.first()
52
-
53
-
54
- def new_address_record(instance):
55
- name, ttl, disable_ptr, zone_id = ipaddress_cf_data(instance)
56
-
57
- if zone_id is None:
58
- return None
59
-
60
- return Record(
61
- name=name,
62
- zone_id=zone_id,
63
- ttl=ttl,
64
- disable_ptr=disable_ptr,
65
- status=address_record_status(instance),
66
- type=address_record_type(instance),
67
- value=str(instance.address.ip),
68
- ipam_ip_address_id=instance.pk,
69
- managed=True,
70
- )
71
-
72
-
73
- def update_address_record(record, ip_address):
74
- name, ttl, disable_ptr, zone_id = ipaddress_cf_data(ip_address)
75
-
76
- record.name = name
77
- record.ttl = ttl
78
- record.disable_ptr = disable_ptr
79
- record.zone_id = zone_id
80
- record.status = address_record_status(ip_address)
81
- record.value = str(ip_address.address.ip)
82
-
83
-
84
- def check_permission(request, permission, record=None):
85
- if record is not None and record.pk is None:
86
- check_record = None
87
- else:
88
- check_record = record
89
-
90
- user = request.user
91
-
92
- if not user.has_perm(permission, check_record):
93
- action = resolve_permission(permission)[1]
94
- item = "records" if check_record is None else f"record {check_record}"
95
-
96
- raise DNSPermissionDenied(f"User {user} is not allowed to {action} DNS {item}")
97
-
98
-
99
- def dns_changed(old, new):
100
- return any(
101
- (
102
- old.address.ip != new.address.ip,
103
- old.custom_field_data.get("ipaddress_dns_record_name")
104
- != new.custom_field_data.get("ipaddress_dns_record_name"),
105
- old.custom_field_data.get("ipaddress_dns_record_ttl")
106
- != new.custom_field_data.get("ipaddress_dns_record_ttl"),
107
- old.custom_field_data.get("ipaddress_dns_record_disable_ptr")
108
- != new.custom_field_data.get("ipaddress_dns_record_disable_ptr"),
109
- old.custom_field_data.get("ipaddress_dns_zone_id")
110
- != new.custom_field_data.get("ipaddress_dns_zone_id"),
111
- )
112
- )