Compare commits
10 commits
1b23c248f9
...
9686e4edee
Author | SHA1 | Date | |
---|---|---|---|
9686e4edee | |||
8e168c4d88 | |||
1283d83060 | |||
00a6ff600b | |||
76a773da33 | |||
8226ee8c3e | |||
6b4bafff5a | |||
4c6aec285b | |||
9efd4faea1 | |||
|
f1f6602985 |
10 changed files with 180 additions and 10 deletions
33
.gitea/workflows/update_changelog.yml
Normal file
33
.gitea/workflows/update_changelog.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
name: update changelog
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-changelog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: master
|
||||||
|
|
||||||
|
- name: install auto-changelog
|
||||||
|
run: npm install auto-changelog
|
||||||
|
|
||||||
|
- name: generate changelog
|
||||||
|
run: >-
|
||||||
|
npx auto-changelog -t keepachangelog
|
||||||
|
--commit-limit 50 --backfill-limit 50
|
||||||
|
--ignore-commit-pattern '[Bb]ump version|[Uu]pdate changelog|[Mm]erge pull request'
|
||||||
|
|
||||||
|
- name: commit and push changelog
|
||||||
|
uses: EndBug/add-and-commit@v9
|
||||||
|
with:
|
||||||
|
add: CHANGELOG.md
|
||||||
|
message: "[bot] update changelog"
|
||||||
|
author_name: actions-bot
|
||||||
|
author_email: actions@bots.44net.ch
|
28
CHANGELOG.md
28
CHANGELOG.md
|
@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||||
|
|
||||||
|
## [v0.3.7](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.6...v0.3.7) - 2024-08-09
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- update ci ciles [`6572375`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/65723753f6747921990fcd4f1b6c39c00005a92e)
|
||||||
|
- always normalize zones [`f1f6602`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/f1f6602985ef57d2b1531f7099a1df7515fbaa6f)
|
||||||
|
- run auto-formatter [`9efd4fa`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/9efd4faea1320a8e037ef0e4a7deab89fb3a95ab)
|
||||||
|
- update to netbox>4.0 and netbox-plugin-dns>1.0 [`6772f0a`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/6772f0a5e0a929cc589c4fb08ff989eb8a962c3c)
|
||||||
|
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v4.0.8 [`aaab7d9`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/aaab7d948e5cba8c34785b5f4c53cee3c6791184)
|
||||||
|
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v4.0.7 [`b528c58`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/b528c58eaed41afd59c3fa76ae5f9940d5ba5049)
|
||||||
|
- remove lefthook from justfile [`f4e877e`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/f4e877e2fe41dbf8a5e52bc795bf04b5da654aed)
|
||||||
|
|
||||||
|
## [v0.3.6](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.5...v0.3.6) - 2024-07-07
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- update tests and deps [`adeca85`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/adeca856be84af888ec7d1de3a567fba5c439f68)
|
||||||
|
- Implement Provider.list_zones for dynamic zone config support [`0051c30`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/0051c30b8d948971b7ec447595b50eef80515993)
|
||||||
|
- use make_absolute function [`60b3226`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/60b322636169fd8a32804f29264fe750caff607b)
|
||||||
|
- fix whitespace [`ba2a3f6`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/ba2a3f6edfe2be8566c609784f659b1638c3922d)
|
||||||
|
- chore(deps): update dependency octodns to v1.7.0 [`cb51054`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/cb510541e25cd5b1d57afc8496b4bb89088f3b3c)
|
||||||
|
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v3.7.6 [`d97d2b7`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/d97d2b749cd5a62e310600b31159665b44e724d7)
|
||||||
|
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v3.7.5 [`cdd9f0d`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/cdd9f0d910f682f8ab70c66887e75f095e43094a)
|
||||||
|
- chore(deps): update dependency octodns to v1.6.1 [`d70c9de`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/d70c9dec0aa532c699feba8bd5991cfe7a7a13d7)
|
||||||
|
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v3.7.4 [`6f1424c`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/6f1424c25e7ce387a70094086a55ece38e6c7342)
|
||||||
|
- chore(deps): update dependency octodns to v1.6.0 [`b19a598`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/b19a598c387c6cc53756bfc0b255ec6134e3aeef)
|
||||||
|
- chore(deps): update dependency just to v1.25.2 [`dff84f4`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/dff84f48ab87fb257ee82ecf7ddb9e2b6993bd86)
|
||||||
|
|
||||||
## [v0.3.5](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.4...v0.3.5) - 2024-03-04
|
## [v0.3.5](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.4...v0.3.5) - 2024-03-04
|
||||||
|
|
||||||
### Commits
|
### Commits
|
||||||
|
|
|
@ -34,11 +34,12 @@ providers:
|
||||||
|
|
||||||
## compatibility
|
## compatibility
|
||||||
|
|
||||||
> actively tested on the newest netbox-plugin-dns and netbox versions
|
> actively tested on the newest `netbox-plugin-dns` and `netbox` versions
|
||||||
|
|
||||||
| provider | [netbox-plugin-dns](https://github.com/peteeckel/netbox-plugin-dns) | [netbox](https://github.com/netbox-community/netbox) |
|
| provider | [netbox-plugin-dns](https://github.com/peteeckel/netbox-plugin-dns) | [netbox](https://github.com/netbox-community/netbox) |
|
||||||
|-------------|---------------------------------------------------------------------|------------------------------------------------------|
|
| ----------- | ------------------------------------------------------------------- | ---------------------------------------------------- |
|
||||||
| `>= v0.3.3` | `>=0.21.0` | `>=3.6.0` |
|
| `>= v0.3.3` | `>=0.21.0` | `>=3.6.0` |
|
||||||
|
| `>= v0.3.6` | `>=1.0.0` | `>=4.0.0` |
|
||||||
|
|
||||||
## install
|
## install
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM lscr.io/linuxserver/netbox:4.0.8
|
FROM lscr.io/linuxserver/netbox:4.0.9
|
||||||
|
|
||||||
RUN pip install -U \
|
RUN pip install -U \
|
||||||
wheel \
|
wheel \
|
||||||
|
|
52
examples/netbox-to-cloudflare.yml
Normal file
52
examples/netbox-to-cloudflare.yml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
manager:
|
||||||
|
max_workers: 2
|
||||||
|
plan_outputs:
|
||||||
|
html:
|
||||||
|
class: octodns.provider.plan.PlanMarkdown
|
||||||
|
|
||||||
|
processors:
|
||||||
|
spf:
|
||||||
|
class: octodns_spf.SpfDnsLookupProcessor
|
||||||
|
no-root-ns:
|
||||||
|
class: octodns.processor.filter.IgnoreRootNsFilter
|
||||||
|
ignore-non-public:
|
||||||
|
class: octodns.processor.filter.NetworkValueRejectlistFilter
|
||||||
|
rejectlist:
|
||||||
|
- 127.0.0.0/8 # loopback
|
||||||
|
- 192.168.0.0/16 # rfc1918
|
||||||
|
- 172.16.0.0/12 # rfc1918
|
||||||
|
- 10.0.0.0/8 # rfc1918
|
||||||
|
- ::1/128 # loopback
|
||||||
|
- fc00::/7 # ula
|
||||||
|
- fe80::/10 # link-local
|
||||||
|
- f00::/8 # multicast
|
||||||
|
|
||||||
|
providers:
|
||||||
|
netbox:
|
||||||
|
class: octodns_netbox_dns.NetBoxDNSProvider
|
||||||
|
url: https://netbox.example.net
|
||||||
|
token: env/NETBOX_API_KEY
|
||||||
|
view: false
|
||||||
|
replace_duplicates: false
|
||||||
|
make_absolute: true
|
||||||
|
cloudflare:
|
||||||
|
class: octodns_cloudflare.CloudflareProvider
|
||||||
|
token: env/CLOUDFLARE_API_KEY
|
||||||
|
account_id: env/CLOUDFLARE_ACCOUNT_ID
|
||||||
|
cdn: false
|
||||||
|
pagerules: false
|
||||||
|
retry_count: 4
|
||||||
|
retry_period: 300
|
||||||
|
zones_per_page: 50
|
||||||
|
records_per_page: 100
|
||||||
|
|
||||||
|
zones:
|
||||||
|
"*":
|
||||||
|
sources:
|
||||||
|
- netbox
|
||||||
|
processors:
|
||||||
|
- spf
|
||||||
|
- no-root-ns
|
||||||
|
- ignore-non-public
|
||||||
|
targets:
|
||||||
|
- cloudflare
|
33
examples/netbox-to-yaml.yml
Normal file
33
examples/netbox-to-yaml.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
manager:
|
||||||
|
max_workers: 2
|
||||||
|
plan_outputs:
|
||||||
|
html:
|
||||||
|
class: octodns.provider.plan.PlanMarkdown
|
||||||
|
|
||||||
|
processors:
|
||||||
|
spf:
|
||||||
|
class: octodns_spf.SpfDnsLookupProcessor
|
||||||
|
|
||||||
|
providers:
|
||||||
|
config:
|
||||||
|
class: octodns.provider.yaml.YamlProvider
|
||||||
|
directory: ./zones
|
||||||
|
default_ttl: 3600
|
||||||
|
enforce_order: true
|
||||||
|
populate_should_replace: false
|
||||||
|
netbox:
|
||||||
|
class: octodns_netbox_dns.NetBoxDNSProvider
|
||||||
|
url: https://netbox.example.net
|
||||||
|
token: env/NETBOX_API_KEY
|
||||||
|
view: false
|
||||||
|
replace_duplicates: false
|
||||||
|
make_absolute: true
|
||||||
|
|
||||||
|
zones:
|
||||||
|
"*":
|
||||||
|
sources:
|
||||||
|
- netbox
|
||||||
|
processors:
|
||||||
|
- spf
|
||||||
|
targets:
|
||||||
|
- config
|
|
@ -69,7 +69,7 @@ validate = ["cd dev && octodns-validate --debug --config-file sync.yml {args}"]
|
||||||
[tool.hatch.envs.lint]
|
[tool.hatch.envs.lint]
|
||||||
python = "3.11"
|
python = "3.11"
|
||||||
detached = true
|
detached = true
|
||||||
dependencies = ["mypy==1.10.0", "ruff==0.5.7"]
|
dependencies = ["mypy==1.10.0", "ruff==0.6.0"]
|
||||||
|
|
||||||
[tool.hatch.envs.lint.scripts]
|
[tool.hatch.envs.lint.scripts]
|
||||||
typing = "mypy --non-interactive --install-types {args:src/octodns_netbox_dns}"
|
typing = "mypy --non-interactive --install-types {args:src/octodns_netbox_dns}"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.3.6"
|
__version__ = "0.3.7"
|
||||||
|
|
|
@ -75,14 +75,18 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
|
||||||
self.make_absolute = make_absolute
|
self.make_absolute = make_absolute
|
||||||
self.disable_ptr = disable_ptr
|
self.disable_ptr = disable_ptr
|
||||||
|
|
||||||
def _make_absolute(self, value: str) -> str:
|
def _make_absolute(self, value: str, force: bool = False) -> str:
|
||||||
"""return dns name with trailing dot to make it absolute
|
"""return dns name with trailing dot to make it absolute
|
||||||
|
|
||||||
@param value: dns record value
|
@param value: dns record value
|
||||||
|
@param force: when `True`, disregard configuration option `make_absolute`
|
||||||
|
|
||||||
@return: absolute dns record value
|
@return: absolute dns record value
|
||||||
"""
|
"""
|
||||||
if not self.make_absolute or value.endswith("."):
|
if value.endswith("."):
|
||||||
|
return value
|
||||||
|
|
||||||
|
if not (self.make_absolute or force):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
absolute_value = value + "."
|
absolute_value = value + "."
|
||||||
|
@ -438,5 +442,6 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
|
||||||
"""
|
"""
|
||||||
query_params = {"status": "active", **self.nb_view}
|
query_params = {"status": "active", **self.nb_view}
|
||||||
zones = self.api.plugins.netbox_dns.zones.filter(**query_params)
|
zones = self.api.plugins.netbox_dns.zones.filter(**query_params)
|
||||||
|
absolute_zones = [self._make_absolute(z.name, True) for z in zones]
|
||||||
|
|
||||||
return sorted([self._make_absolute(z.name) for z in zones])
|
return sorted(absolute_zones)
|
||||||
|
|
|
@ -11,7 +11,7 @@ DEFAULT_CONFIG = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test1():
|
def test_absolute():
|
||||||
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
|
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
|
||||||
rcd = "example.com"
|
rcd = "example.com"
|
||||||
absolute = nbdns._make_absolute(rcd)
|
absolute = nbdns._make_absolute(rcd)
|
||||||
|
@ -19,9 +19,27 @@ def test1():
|
||||||
assert absolute == "example.com."
|
assert absolute == "example.com."
|
||||||
|
|
||||||
|
|
||||||
def test2():
|
def test_noop():
|
||||||
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
|
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
|
||||||
rcd = "example.com."
|
rcd = "example.com."
|
||||||
absolute = nbdns._make_absolute(rcd)
|
absolute = nbdns._make_absolute(rcd)
|
||||||
|
|
||||||
assert absolute == "example.com."
|
assert absolute == "example.com."
|
||||||
|
|
||||||
|
|
||||||
|
def test_disabled():
|
||||||
|
args = {**DEFAULT_CONFIG, "make_absolute": False}
|
||||||
|
nbdns = NetBoxDNSProvider(**args)
|
||||||
|
rcd = "example.com"
|
||||||
|
relative = nbdns._make_absolute(rcd, force=False)
|
||||||
|
|
||||||
|
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."
|
||||||
|
|
Loading…
Reference in a new issue