Merge pull request #9 from ghcz/main
Several fixes for new pynetbox and Netbox
This commit is contained in:
commit
6fc3d45cad
|
@ -86,7 +86,7 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider):
|
|||
"""Given a zone name and a view name, look it up in NetBox.
|
||||
Raises: pynetbox.RequestError if declared view is not existant"""
|
||||
view = "null" if not view else view
|
||||
nb_zone = self._api.plugins.netbox_dns.zones.get(name=name[:-1], view=view)
|
||||
nb_zone = self._api.plugins.netbox_dns.zones.get(name=name[:-1], view_id=view.id)
|
||||
|
||||
return nb_zone
|
||||
|
||||
|
@ -110,10 +110,18 @@ class NetBoxDNSSource(octodns.provider.base.BaseProvider):
|
|||
name = nb_record.name
|
||||
if name == "@":
|
||||
name = ""
|
||||
|
||||
nb_zone_default_ttl = nb_zone.default_ttl
|
||||
if nb_record.ttl:
|
||||
nb_ttl = nb_record.ttl
|
||||
elif nb_record.type == "NS":
|
||||
nb_ttl = nb_zone.soa_refresh
|
||||
else:
|
||||
nb_ttl = nb_zone_default_ttl
|
||||
data = {
|
||||
"name": name,
|
||||
"type": nb_record.type,
|
||||
"ttl": nb_record.ttl,
|
||||
"ttl": nb_ttl,
|
||||
"values": [],
|
||||
}
|
||||
rdata = dns.rdata.from_text("IN", nb_record.type, nb_record.value)
|
||||
|
|
|
@ -8,13 +8,7 @@ authors = ["Jeffrey C. Ollie <jeff@ocjtech.us>"]
|
|||
python = "^3.10"
|
||||
octodns = "^0.9.17"
|
||||
|
||||
# There's a bug in pynetbox that prevents update & delete operations on plugin REST API endpoints.
|
||||
# Until pull request #426 is merged I recommend using my fork of pynetbox which has #426 applied to
|
||||
# the version 6.6.2 of pynetbox (the original pull request is against an older version).
|
||||
#
|
||||
# pynetbox = "^6.6.2"
|
||||
#
|
||||
pynetbox = { git = "https://github.com/jcollie/pynetbox.git", rev = "35449e0e87105d9a6170bcc333d6a1882c945cd0" }
|
||||
pynetbox = "^7.0.1"
|
||||
|
||||
dnspython = "^2.2.1"
|
||||
|
||||
|
|
Loading…
Reference in New Issue