Compare commits
No commits in common. "main" and "dev" have entirely different histories.
18 changed files with 83 additions and 391 deletions
|
@ -1,4 +1,4 @@
|
||||||
name: build pypackage and create release
|
name: build and publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -9,55 +9,16 @@ on:
|
||||||
branches: [main, master]
|
branches: [main, master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-github:
|
release-pypackage:
|
||||||
runs-on: ubuntu-latest
|
uses: actions/workflows/.gitea/workflows/release_pypackage.yml@master
|
||||||
env:
|
with:
|
||||||
HATCH_INDEX_REPO: main
|
repository: main
|
||||||
HATCH_INDEX_USER: __token__
|
secrets:
|
||||||
HATCH_INDEX_AUTH: ${{ secrets.PACKAGE_TOKEN }}
|
username: __token__
|
||||||
steps:
|
token: ${{ secrets.PACKAGE_TOKEN }}
|
||||||
- name: checkout code
|
gh-token: ${{ secrets.GH_TOKEN }}
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
update-changelog:
|
||||||
with:
|
uses: actions/workflows/.gitea/workflows/update_changelog.yml@master
|
||||||
python-version: "3.11"
|
with:
|
||||||
|
branch: main
|
||||||
- name: setup go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ">=1.20"
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch hatchling
|
|
||||||
|
|
||||||
- name: build package
|
|
||||||
run: hatch build --clean
|
|
||||||
|
|
||||||
- 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: get release notes
|
|
||||||
id: release-notes
|
|
||||||
uses: olofvndrhr/releasenote-gen@v1
|
|
||||||
|
|
||||||
- name: publish package
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
run: hatch publish --yes --no-prompt
|
|
||||||
|
|
||||||
- name: create gitea release
|
|
||||||
uses: https://gitea.com/actions/release-action@main
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
with:
|
|
||||||
title: ${{ gitea.ref_name }}
|
|
||||||
body: ${{ steps.release-notes.outputs.releasenotes }}
|
|
||||||
files: |-
|
|
||||||
dist/**
|
|
||||||
|
|
|
@ -9,23 +9,6 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-code:
|
check-code:
|
||||||
runs-on: ubuntu-latest
|
uses: actions/workflows/.gitea/workflows/check_python_hatch.yml@master
|
||||||
steps:
|
with:
|
||||||
- name: checkout code
|
run-tests: true
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.11"
|
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch
|
|
||||||
|
|
||||||
- name: test codestyle
|
|
||||||
run: hatch run lint:style
|
|
||||||
|
|
||||||
- name: test typing
|
|
||||||
run: hatch run lint:typing
|
|
||||||
|
|
||||||
- name: run tests
|
|
||||||
run: hatch run default:test
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
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: main
|
|
||||||
|
|
||||||
- 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
|
|
20
.github/workflows/build_release.yml
vendored
20
.github/workflows/build_release.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: build pypackage and create release
|
name: build and release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -17,7 +17,7 @@ jobs:
|
||||||
HATCH_INDEX_AUTH: ${{ secrets.PACKAGE_TOKEN }}
|
HATCH_INDEX_AUTH: ${{ secrets.PACKAGE_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: checkout code
|
- name: checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
@ -25,18 +25,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
|
||||||
- name: install hatch
|
|
||||||
run: pip install -U hatch hatchling
|
|
||||||
|
|
||||||
- name: build package
|
|
||||||
run: hatch build --clean
|
|
||||||
|
|
||||||
- name: install auto-changelog
|
- name: install auto-changelog
|
||||||
run: npm install auto-changelog
|
run: npm install -g auto-changelog
|
||||||
|
|
||||||
- name: generate changelog
|
- name: generate changelog
|
||||||
run: >-
|
run: >-
|
||||||
npx auto-changelog -t keepachangelog
|
auto-changelog -t keepachangelog
|
||||||
--commit-limit 50 --backfill-limit 50
|
--commit-limit 50 --backfill-limit 50
|
||||||
--ignore-commit-pattern '[Bb]ump version|[Uu]pdate changelog|[Mm]erge pull request'
|
--ignore-commit-pattern '[Bb]ump version|[Uu]pdate changelog|[Mm]erge pull request'
|
||||||
|
|
||||||
|
@ -44,6 +38,12 @@ jobs:
|
||||||
id: release-notes
|
id: release-notes
|
||||||
uses: olofvndrhr/releasenote-gen@v1
|
uses: olofvndrhr/releasenote-gen@v1
|
||||||
|
|
||||||
|
- name: install hatch
|
||||||
|
run: pip install -U hatch hatchling
|
||||||
|
|
||||||
|
- name: build package
|
||||||
|
run: hatch build --clean
|
||||||
|
|
||||||
- name: create github release
|
- name: create github release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
just 1.25.2
|
just 1.16.0
|
||||||
|
lefthook 1.4.6
|
||||||
|
|
65
CHANGELOG.md
65
CHANGELOG.md
|
@ -7,71 +7,6 @@ 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.9](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.8...v0.3.9) - 2024-09-12
|
|
||||||
|
|
||||||
### Commits
|
|
||||||
|
|
||||||
- caa records: convert bytes values to string [`5a35e1b`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/5a35e1b51e4ba8e9b1c9e172d11ae8684e344eb9)
|
|
||||||
- fix changelog action [`015745f`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/015745f353cd29861c2b6a4927e8f3cdf137f4ec)
|
|
||||||
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v4.1.0 [`d04d72b`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/d04d72bad043b37ac745d055f2e482493b7e962b)
|
|
||||||
|
|
||||||
## [v0.3.8](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.7...v0.3.8) - 2024-08-30
|
|
||||||
|
|
||||||
### Commits
|
|
||||||
|
|
||||||
- add examples [`1283d83`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/1283d83060ca0728fe399bccbc01a1a5f27452ce)
|
|
||||||
- fix cicd files [`8e168c4`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/8e168c4d88de25da1a68eff15d955968daa6b23a)
|
|
||||||
- update version matrix [`00a6ff6`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/00a6ff600beeeb25e432e5ccac774c43e1fdd3fb)
|
|
||||||
- set SUPPORTS_DYNAMIC to true [`cb3ea58`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/cb3ea583e1ab126b49f3f31055cec8f541d78716)
|
|
||||||
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v4.0.10 [`e07b905`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/e07b9054eab1e9baf7676ac36a8989a00ab23c80)
|
|
||||||
- chore(deps): update lscr.io/linuxserver/netbox docker tag to v4.0.9 [`6b4baff`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/6b4bafff5ace100d3de651c50c5d25063907819b)
|
|
||||||
- chore(deps): update actions/setup-go action to v5 [`1cce3ee`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/1cce3eee7376c56ef89528e35384c75dc5a279e6)
|
|
||||||
|
|
||||||
## [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
|
|
||||||
|
|
||||||
### Commits
|
|
||||||
|
|
||||||
- add new tests [`a8ecfab`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/a8ecfab93096cd3201efcb06a65bc86a2444611a)
|
|
||||||
- fix typo in method call and add function for semicolons [`afe1826`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/afe182628a7b2fc784dc48bebaf9978c85d682d2)
|
|
||||||
- update ci files for github [`6b06cad`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/6b06cada38751648b9365fd27b850aa2b6d250a8)
|
|
||||||
- unescape the changeset before comparison to live records to have an accurate changeset. fixes changes for txt records [`4fe8be6`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/4fe8be62918b5bea821f4f88a151918899b61e91)
|
|
||||||
- rollback changes to semicolon escaping [`91ba03a`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/91ba03af7f5f53a7f3b5218f0f4a905eebcdb914)
|
|
||||||
- revert: change from repr to string in changeset [`8d29b5e`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/8d29b5e639b25bb57b43e9e85bbe78e51d70b493)
|
|
||||||
- update logging [`ff1a47c`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/ff1a47cf8cda21695fb4e30910dd92d0f9cb8b63)
|
|
||||||
- update test cases [`f38a103`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/f38a1036b79b9779a8480c2d1f79132370b83bb4)
|
|
||||||
- change from repr to string in changeset [`696d2a2`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/696d2a2532eef05fee95cddff627c9b09736ae52)
|
|
||||||
- only unescape txt and spf records [`78448d2`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/78448d2bde85fda1718c64e6cd8983b4fcb20fe0)
|
|
||||||
- fix semicolon escaping [`6e624a7`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/6e624a79a75051295d1863f9af7e907d44a9b307)
|
|
||||||
- fix tests [`2e468c8`](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/commit/2e468c85699808ed9ba2edb35a6cc39591869346)
|
|
||||||
|
|
||||||
## [v0.3.4](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.3...v0.3.4) - 2024-02-29
|
## [v0.3.4](https://git.44net.ch/olofvndrhr/octodns-netbox-dns/compare/v0.3.3...v0.3.4) - 2024-02-29
|
||||||
|
|
||||||
### Commits
|
### Commits
|
||||||
|
|
|
@ -34,12 +34,11 @@ 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,6 +1,6 @@
|
||||||
FROM lscr.io/linuxserver/netbox:4.1.3
|
FROM lscr.io/linuxserver/netbox:3.7.3
|
||||||
|
|
||||||
RUN pip install -U \
|
RUN pip install -U \
|
||||||
wheel \
|
wheel \
|
||||||
setuptools \
|
setuptools \
|
||||||
netbox-plugin-dns==1.0.4
|
netbox-plugin-dns
|
||||||
|
|
|
@ -14,7 +14,7 @@ PLUGINS_CONFIG = {
|
||||||
"zone_nameservers": ["ns1.example.com", "ns2.example.com"],
|
"zone_nameservers": ["ns1.example.com", "ns2.example.com"],
|
||||||
"zone_soa_mname": "ns1.example.com",
|
"zone_soa_mname": "ns1.example.com",
|
||||||
"zone_soa_rname": "admin.example.com",
|
"zone_soa_rname": "admin.example.com",
|
||||||
"tolerate_underscores_in_labels": False,
|
"tolerate_underscores_in_hostnames": False,
|
||||||
"tolerate_leading_underscore_types": [
|
"tolerate_leading_underscore_types": [
|
||||||
"TXT",
|
"TXT",
|
||||||
"SRV",
|
"SRV",
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
manager:
|
|
||||||
max_workers: 1
|
|
||||||
plan_outputs:
|
|
||||||
html:
|
|
||||||
class: octodns.provider.plan.PlanMarkdown
|
|
||||||
processors:
|
|
||||||
spf:
|
|
||||||
class: octodns_spf.SpfDnsLookupProcessor
|
|
||||||
no-root-ns:
|
|
||||||
class: octodns.processor.filter.IgnoreRootNsFilter
|
|
||||||
min-max-ttl:
|
|
||||||
class: octodns.processor.restrict.TtlRestrictionFilter
|
|
||||||
allowed_ttls:
|
|
||||||
- 60
|
|
||||||
- 300
|
|
||||||
- 600
|
|
||||||
- 900
|
|
||||||
- 1800
|
|
||||||
- 3600
|
|
||||||
- 7200
|
|
||||||
- 10800
|
|
||||||
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: http://localhost:8000
|
|
||||||
token: 1ca8f8de1d651b0859052dc5e6a0858fd1e43e3d # change token for netbox
|
|
||||||
view: false
|
|
||||||
replace_duplicates: false
|
|
||||||
make_absolute: true
|
|
||||||
zones:
|
|
||||||
"*":
|
|
||||||
sources:
|
|
||||||
- config
|
|
||||||
processors:
|
|
||||||
- spf
|
|
||||||
targets:
|
|
||||||
- netbox
|
|
|
@ -1,52 +0,0 @@
|
||||||
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
|
|
|
@ -1,33 +0,0 @@
|
||||||
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
|
|
4
justfile
4
justfile
|
@ -19,6 +19,7 @@ show_system_info:
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
asdf install
|
asdf install
|
||||||
|
lefthook install
|
||||||
|
|
||||||
create_venv:
|
create_venv:
|
||||||
@echo "creating venv"
|
@echo "creating venv"
|
||||||
|
@ -76,8 +77,5 @@ sync *args:
|
||||||
dump *args:
|
dump *args:
|
||||||
hatch -v run default:dump {{ args }}
|
hatch -v run default:dump {{ args }}
|
||||||
|
|
||||||
dump2 *args:
|
|
||||||
hatch -v run default:dump2 {{ args }}
|
|
||||||
|
|
||||||
validate *args:
|
validate *args:
|
||||||
hatch -v run default:validate {{ args }}
|
hatch -v run default:validate {{ args }}
|
||||||
|
|
14
lefthook.yml
Normal file
14
lefthook.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
colors: true
|
||||||
|
no_tty: false
|
||||||
|
|
||||||
|
pre-commit:
|
||||||
|
commands:
|
||||||
|
01_ruff_check:
|
||||||
|
stage_fixed: true
|
||||||
|
glob: "*.py"
|
||||||
|
run: ruff check --fix-only --exit-zero --silent {all_files}
|
||||||
|
|
||||||
|
02_ruff_format:
|
||||||
|
stage_fixed: true
|
||||||
|
glob: "*.py"
|
||||||
|
run: ruff format {all_files}
|
|
@ -1,5 +1,5 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling>=1.24", "hatch-regex-commit>=0.0.3"]
|
requires = ["hatchling>=1.18", "hatch-regex-commit>=0.0.3"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
|
@ -11,7 +11,7 @@ requires-python = ">=3.11"
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Jeffrey C. Ollie", email = "" },
|
{ name = "Jeffrey C. Ollie", email = "" },
|
||||||
{ name = "Ivan Schaller", email = "ivan@schaller.sh" },
|
{ name = "Ivan Schaller", email = "ivan@schaller.sh" }
|
||||||
]
|
]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
|
@ -19,7 +19,10 @@ classifiers = [
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
]
|
]
|
||||||
dependencies = ["pynetbox>=7.2.0", "dnspython>=2.4.2"]
|
dependencies = [
|
||||||
|
"pynetbox>=7.2.0",
|
||||||
|
"dnspython>=2.4.2",
|
||||||
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://github.com/olofvndrhr/octodns-netbox-dns"
|
Homepage = "https://github.com/olofvndrhr/octodns-netbox-dns"
|
||||||
|
@ -45,9 +48,9 @@ packages = ["src/octodns_netbox_dns"]
|
||||||
[tool.hatch.envs.default]
|
[tool.hatch.envs.default]
|
||||||
python = "3.11"
|
python = "3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pytest==8.2.2",
|
"pytest==7.4.4",
|
||||||
"coverage==7.5.3",
|
"coverage==7.4.2",
|
||||||
"octodns==1.9.1",
|
"octodns==1.5.0",
|
||||||
"octodns-spf==0.0.2",
|
"octodns-spf==0.0.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -58,23 +61,28 @@ cov-report = ["- coverage combine", "coverage report", "coverage xml"]
|
||||||
cov = ["test-cov", "cov-report"]
|
cov = ["test-cov", "cov-report"]
|
||||||
|
|
||||||
sync = ["cd dev && octodns-sync --debug --config-file sync.yml --force {args}"]
|
sync = ["cd dev && octodns-sync --debug --config-file sync.yml --force {args}"]
|
||||||
dump = [
|
dump = ["cd dev && octodns-dump --debug --config-file sync.yml --output-dir output {args} '*' netbox"]
|
||||||
"cd dev && octodns-dump --debug --config-file sync.yml --output-dir output {args} '*' netbox",
|
|
||||||
]
|
|
||||||
dump2 = [
|
|
||||||
"cd dev && octodns-dump --debug --config-file sync2.yml --output-dir output {args} '*' netbox",
|
|
||||||
]
|
|
||||||
validate = ["cd dev && octodns-validate --debug --config-file sync.yml {args}"]
|
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.4.8"]
|
dependencies = [
|
||||||
|
"mypy==1.8.0",
|
||||||
|
"ruff==0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
[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}"
|
||||||
style = ["ruff check --diff {args:.}", "ruff format --check --diff {args:.}"]
|
style = [
|
||||||
fmt = ["ruff check --fix {args:.}", "ruff format {args:.}", "style"]
|
"ruff check --diff {args:.}",
|
||||||
|
"ruff format --check --diff {args:.}"
|
||||||
|
]
|
||||||
|
fmt = [
|
||||||
|
"ruff check --fix {args:.}",
|
||||||
|
"ruff format {args:.}",
|
||||||
|
"style"
|
||||||
|
]
|
||||||
all = ["style", "typing"]
|
all = ["style", "typing"]
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -104,7 +112,7 @@ exclude = [
|
||||||
"dist",
|
"dist",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"venv",
|
"venv",
|
||||||
"dev",
|
"dev"
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
|
@ -135,18 +143,8 @@ select = [
|
||||||
"W",
|
"W",
|
||||||
"YTT",
|
"YTT",
|
||||||
]
|
]
|
||||||
ignore = [
|
ignore-init-module-imports = true
|
||||||
"E501",
|
ignore = ["E501", "D103", "D100", "D102", "PLR2004", "D403", "ISC001", "FBT001", "FBT002", "FBT003"]
|
||||||
"D103",
|
|
||||||
"D100",
|
|
||||||
"D102",
|
|
||||||
"PLR2004",
|
|
||||||
"D403",
|
|
||||||
"ISC001",
|
|
||||||
"FBT001",
|
|
||||||
"FBT002",
|
|
||||||
"FBT003",
|
|
||||||
]
|
|
||||||
unfixable = ["F401"]
|
unfixable = ["F401"]
|
||||||
|
|
||||||
[tool.ruff.format]
|
[tool.ruff.format]
|
||||||
|
@ -233,10 +231,7 @@ parallel = true
|
||||||
omit = ["src/octodns_netbox_dns/__about__.py"]
|
omit = ["src/octodns_netbox_dns/__about__.py"]
|
||||||
|
|
||||||
[tool.coverage.paths]
|
[tool.coverage.paths]
|
||||||
octodns_netbox_dns = [
|
octodns_netbox_dns = ["src/octodns_netbox_dns", "*/octodns-netbox-dns/src/octodns_netbox_dns"]
|
||||||
"src/octodns_netbox_dns",
|
|
||||||
"*/octodns-netbox-dns/src/octodns_netbox_dns",
|
|
||||||
]
|
|
||||||
tests = ["tests", "*/octodns-netbox-dns/tests"]
|
tests = ["tests", "*/octodns-netbox-dns/tests"]
|
||||||
|
|
||||||
[tool.coverage.report]
|
[tool.coverage.report]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.3.9"
|
__version__ = "0.3.4"
|
||||||
|
|
|
@ -14,7 +14,7 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
|
||||||
"""OctoDNS provider for NetboxDNS"""
|
"""OctoDNS provider for NetboxDNS"""
|
||||||
|
|
||||||
SUPPORTS_GEO = False
|
SUPPORTS_GEO = False
|
||||||
SUPPORTS_DYNAMIC = True
|
SUPPORTS_DYNAMIC = False
|
||||||
SUPPORTS_ROOT_NS = True
|
SUPPORTS_ROOT_NS = True
|
||||||
SUPPORTS_MULTIVALUE_PTR = True
|
SUPPORTS_MULTIVALUE_PTR = True
|
||||||
SUPPORTS: set[str] = { # noqa
|
SUPPORTS: set[str] = { # noqa
|
||||||
|
@ -75,18 +75,14 @@ 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, force: bool = False) -> str:
|
def _make_absolute(self, value: str) -> 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 value.endswith("."):
|
if not self.make_absolute or value.endswith("."):
|
||||||
return value
|
|
||||||
|
|
||||||
if not (self.make_absolute or force):
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
absolute_value = value + "."
|
absolute_value = value + "."
|
||||||
|
@ -165,8 +161,8 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
|
||||||
case "CAA":
|
case "CAA":
|
||||||
value = {
|
value = {
|
||||||
"flags": rdata.flags,
|
"flags": rdata.flags,
|
||||||
"tag": rdata.tag.decode(),
|
"tag": rdata.tag,
|
||||||
"value": rdata.value.decode(),
|
"value": rdata.value,
|
||||||
}
|
}
|
||||||
|
|
||||||
case "LOC":
|
case "LOC":
|
||||||
|
@ -434,14 +430,3 @@ class NetBoxDNSProvider(octodns.provider.base.BaseProvider):
|
||||||
value=record,
|
value=record,
|
||||||
disable_ptr=self.disable_ptr,
|
disable_ptr=self.disable_ptr,
|
||||||
)
|
)
|
||||||
|
|
||||||
def list_zones(self) -> list[str]:
|
|
||||||
"""get all zones from netbox
|
|
||||||
|
|
||||||
@return: a list with all active zones
|
|
||||||
"""
|
|
||||||
query_params = {"status": "active", **self.nb_view}
|
|
||||||
zones = self.api.plugins.netbox_dns.zones.filter(**query_params)
|
|
||||||
absolute_zones = [self._make_absolute(z.name, True) for z in zones]
|
|
||||||
|
|
||||||
return sorted(absolute_zones)
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ DEFAULT_CONFIG = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_absolute():
|
def test1():
|
||||||
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,27 +19,9 @@ def test_absolute():
|
||||||
assert absolute == "example.com."
|
assert absolute == "example.com."
|
||||||
|
|
||||||
|
|
||||||
def test_noop():
|
def test2():
|
||||||
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