diff --git a/octodns_netbox_dns/__init__.py b/octodns_netbox_dns/__init__.py index 89a68e3..8cf4c2b 100644 --- a/octodns_netbox_dns/__init__.py +++ b/octodns_netbox_dns/__init__.py @@ -59,7 +59,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): } _api: pynetbox.core.api.Api - _log: logging.Logger + # log: logging.Logger _nb_view: pynetbox.core.response.Record | None _ttl: int @@ -78,7 +78,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): self._nb_view = self._api.plugins.netbox_dns.views.get(name=view) if self._nb_view is None: raise ValueError - self._log.debug(f"found {self._nb_view.name} {self._nb_view.id}") + self.log.debug(f"found {self._nb_view.name} {self._nb_view.id}") self._ttl = ttl self.replace_duplicates = replace_duplicates @@ -96,7 +96,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): view_id=self._nb_view.id, name=name[:-1] ) for nb_zone in nb_zones: - self._log.debug(f"{nb_zone.name} {nb_zone.view.id}") + self.log.debug(f"{nb_zone.name} {nb_zone.view.id}") if nb_zone.name == name[:-1] and nb_zone.view.id == self._nb_view.id: return nb_zone @@ -106,7 +106,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): self, zone: octodns.zone.Zone, target: bool = False, lenient: bool = False ): """Get all of the records of a zone from NetBox and add them to the OctoDNS zone.""" - self._log.debug( + self.log.debug( f"populate: name={zone.name}, target={target}, lenient={lenient}" ) @@ -116,7 +116,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): nb_records = self._api.plugins.netbox_dns.records.filter(zone_id=nb_zone.id) for nb_record in nb_records: - self._log.debug( + self.log.debug( f"{nb_record.name!r} {nb_record.type!r} {nb_record.value!r}" ) name = nb_record.name @@ -183,7 +183,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): } case "SOA": - self._log.debug("SOA") + self.log.debug("SOA") continue case "SPF" | "TXT": @@ -219,7 +219,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): def _apply(self, plan: octodns.provider.plan.Plan): """Apply the changes to the NetBox DNS zone.""" - self._log.debug( + self.log.debug( f"_apply: zone={plan.desired.name}, len(changes)={len(plan.changes)}" ) @@ -250,7 +250,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): value=value, disable_ptr=True, ) - self._log.debug(f"{nb_record!r}") + self.log.debug(f"{nb_record!r}") case octodns.record.Delete(): name = change.existing.name @@ -276,10 +276,10 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider): for nb_record in nb_records: for value in existing: if nb_record.value == value: - self._log.debug( + self.log.debug( f"{nb_record.id} {nb_record.name} {nb_record.type} {nb_record.value} {value}" ) - self._log.debug( + self.log.debug( f"{nb_record.url} {nb_record.endpoint.url}" ) nb_record.delete() diff --git a/poetry.lock b/poetry.lock index 030a127..843590d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,18 +1,18 @@ [[package]] name = "certifi" -version = "2021.10.8" +version = "2022.6.15.1" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6" [[package]] name = "charset-normalizer" -version = "2.0.12" +version = "2.1.1" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "main" optional = false -python-versions = ">=3.5.0" +python-versions = ">=3.6.0" [package.extras] unicode_backport = ["unicodedata2"] @@ -26,8 +26,8 @@ optional = false python-versions = ">=3.6,<4.0" [package.extras] -dnssec = ["cryptography (>=2.6,<37.0)"] curio = ["curio (>=1.2,<2.0)", "sniffio (>=1.1,<2.0)"] +dnssec = ["cryptography (>=2.6,<37.0)"] doh = ["h2 (>=4.1.0)", "httpx (>=0.21.1)", "requests (>=2.23.0,<3.0.0)", "requests-toolbelt (>=0.9.1,<0.10.0)"] idna = ["idna (>=2.1,<4.0)"] trio = ["trio (>=0.14,<0.20)"] @@ -51,7 +51,7 @@ python-versions = ">=3.5" [[package]] name = "natsort" -version = "8.1.0" +version = "8.2.0" description = "Simple yet flexible natural sorting in Python." category = "main" optional = false @@ -63,7 +63,7 @@ icu = ["PyICU (>=1.0.0)"] [[package]] name = "octodns" -version = "0.9.17" +version = "0.9.19" description = "OctoDNS: DNS as code - Tools for managing DNS across multiple providers" category = "main" optional = false @@ -72,12 +72,13 @@ python-versions = ">=3.6" [package.dependencies] dnspython = ">=1.15.0" fqdn = ">=1.5.0" +idna = ">=3.3" natsort = ">=5.5.0" python-dateutil = ">=2.8.1" PyYaml = ">=4.2b1" [package.extras] -dev = ["pytest (>=6.2.5)", "pytest-cov (>=3.0.0)", "pytest-network (>=0.0.1)", "build (>=0.7.0)", "pycodestyle (>=2.6.0)", "pycountry (>=19.8.18)", "pycountry-convert (>=0.7.2)", "pyflakes (>=2.2.0)", "readme-renderer[md] (>=26.0)", "twine (>=3.4.2)"] +dev = ["black (>=22.3.0)", "build (>=0.7.0)", "pycountry (>=19.8.18)", "pycountry-convert (>=0.7.2)", "pyflakes (>=2.2.0)", "pytest (>=6.2.5)", "pytest-cov (>=3.0.0)", "pytest-network (>=0.0.1)", "readme-renderer[md] (>=26.0)", "twine (>=3.4.2)"] [[package]] name = "pynetbox" @@ -110,7 +111,7 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" six = ">=1.5" [[package]] -name = "pyyaml" +name = "PyYAML" version = "6.0" description = "YAML parser and emitter for Python" category = "main" @@ -119,21 +120,21 @@ python-versions = ">=3.6" [[package]] name = "requests" -version = "2.27.1" +version = "2.28.1" description = "Python HTTP for Humans." category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = ">=3.7, <4" [package.dependencies] certifi = ">=2017.4.17" -charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""} -idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""} +charset-normalizer = ">=2,<3" +idna = ">=2.5,<4" urllib3 = ">=1.21.1,<1.27" [package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] -use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "six" @@ -145,15 +146,15 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "urllib3" -version = "1.26.9" +version = "1.26.12" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" [package.extras] -brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [metadata] @@ -163,12 +164,12 @@ content-hash = "e07320a890e7853587f5517b7e53ab4a632db308c630ee927a79e851836af165 [metadata.files] certifi = [ - {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, - {file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"}, + {file = "certifi-2022.6.15.1-py3-none-any.whl", hash = "sha256:43dadad18a7f168740e66944e4fa82c6611848ff9056ad910f8f7a3e46ab89e0"}, + {file = "certifi-2022.6.15.1.tar.gz", hash = "sha256:cffdcd380919da6137f76633531a5817e3a9f268575c128249fb637e4f9e73fb"}, ] charset-normalizer = [ - {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, - {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, + {file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"}, + {file = "charset_normalizer-2.1.1-py3-none-any.whl", hash = "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"}, ] dnspython = [ {file = "dnspython-2.2.1-py3-none-any.whl", hash = "sha256:a851e51367fb93e9e1361732c1d60dab63eff98712e503ea7d92e6eccb109b4f"}, @@ -183,19 +184,19 @@ idna = [ {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, ] natsort = [ - {file = "natsort-8.1.0-py3-none-any.whl", hash = "sha256:f59988d2f24e77b6b56f8a8f882d5df6b3b637e09e075abc67b486d59fba1a4b"}, - {file = "natsort-8.1.0.tar.gz", hash = "sha256:c7c1f3f27c375719a4dfcab353909fe39f26c2032a062a8c80cc844eaaca0445"}, + {file = "natsort-8.2.0-py3-none-any.whl", hash = "sha256:04fe18fdd2b9e5957f19f687eb117f102ef8dde6b574764e536e91194bed4f5f"}, + {file = "natsort-8.2.0.tar.gz", hash = "sha256:57f85b72c688b09e053cdac302dd5b5b53df5f73ae20b4874fcbffd8bf783d11"}, ] octodns = [ - {file = "octodns-0.9.17-py3-none-any.whl", hash = "sha256:b35480dfcc8f78f636f869daa42fda5d47afd6dab5373ba44acde6eef87546db"}, - {file = "octodns-0.9.17.tar.gz", hash = "sha256:3b7a4d6b0c938d96ec77202d5fedbbe5426761450f912354ad16bb87e99930f1"}, + {file = "octodns-0.9.19-py3-none-any.whl", hash = "sha256:a404a89a07ec89cb95afcde7ced7c3b0de898e4d6969fffb663fa98c6f8a11f7"}, + {file = "octodns-0.9.19.tar.gz", hash = "sha256:801f11d36862fcd5fe75c1836db0a98eec89946fe112caa75ae5faff607ca0e3"}, ] pynetbox = [] python-dateutil = [ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, ] -pyyaml = [ +PyYAML = [ {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, @@ -231,14 +232,14 @@ pyyaml = [ {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, ] requests = [ - {file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"}, - {file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"}, + {file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"}, + {file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"}, ] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] urllib3 = [ - {file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"}, - {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, + {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, + {file = "urllib3-1.26.12.tar.gz", hash = "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"}, ]