Skip to content

Commit

Permalink
run auto-formatter
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Schaller <[email protected]>
  • Loading branch information
olofvndrhr committed Aug 9, 2024
1 parent f1f6602 commit 9efd4fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/octodns_netbox_dns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ def __init__(
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
Expand Down Expand Up @@ -443,6 +442,6 @@ def list_zones(self) -> list[str]:
"""
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)
4 changes: 3 additions & 1 deletion tests/test_make_absolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_noop():

assert absolute == "example.com."


def test_disabled():
args = {**DEFAULT_CONFIG, "make_absolute": False}
nbdns = NetBoxDNSProvider(**args)
Expand All @@ -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."

0 comments on commit 9efd4fa

Please sign in to comment.