run auto-formatter
All checks were successful
check code / check-code (push) Successful in 18s

Signed-off-by: Ivan Schaller <ivan@schaller.sh>
This commit is contained in:
Ivan Schaller 2024-08-09 10:59:15 +02:00
parent f1f6602985
commit 9efd4faea1
2 changed files with 6 additions and 5 deletions

View file

@ -75,11 +75,10 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
self.make_absolute = make_absolute
self.disable_ptr = disable_ptr
def _make_absolute(self, value: str, force : bool = False) -> str:
def _make_absolute(self, value: str, force: bool = False) -> str:
"""return dns name with trailing dot to make it absolute
@param value: dns record value
@param force: when `True`, disregard configuration option `make_absolute`
@return: absolute dns record value
@ -443,6 +442,6 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
"""
query_params = {"status": "active", **self.nb_view}
zones = self.api.plugins.netbox_dns.zones.filter(**query_params)
zones = [self._make_absolute(z.name, True) for z in zones]
absolute_zones = [self._make_absolute(z.name, True) for z in zones]
return sorted(zones)
return sorted(absolute_zones)

View file

@ -26,6 +26,7 @@ def test_noop():
assert absolute == "example.com."
def test_disabled():
args = {**DEFAULT_CONFIG, "make_absolute": False}
nbdns = NetBoxDNSProvider(**args)
@ -34,10 +35,11 @@ def test_disabled():
assert relative == "example.com"
def test_force():
args = {**DEFAULT_CONFIG, "make_absolute": False}
nbdns = NetBoxDNSProvider(**args)
rcd = "example.com"
absolute = nbdns._make_absolute(rcd, force=True)
assert absolute == "example.com."
assert absolute == "example.com."