mreg-cli 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. mreg_cli-1.0.0/.github/workflows/publish.yml +128 -0
  2. mreg_cli-1.0.0/.github/workflows/test.yml +54 -0
  3. mreg_cli-1.0.0/.gitignore +112 -0
  4. mreg_cli-1.0.0/AUTHORS +12 -0
  5. mreg_cli-1.0.0/CHANGELOG +36 -0
  6. mreg_cli-1.0.0/CONTRIBUTING +38 -0
  7. mreg_cli-1.0.0/LICENSE +674 -0
  8. mreg_cli-1.0.0/PKG-INFO +1079 -0
  9. mreg_cli-1.0.0/README.md +370 -0
  10. mreg_cli-1.0.0/ci/diff.py +340 -0
  11. mreg_cli-1.0.0/ci/docker-compose.yml +42 -0
  12. mreg_cli-1.0.0/ci/run_testsuite_and_record.sh +46 -0
  13. mreg_cli-1.0.0/ci/testsuite +382 -0
  14. mreg_cli-1.0.0/ci/testsuite-result.json +31720 -0
  15. mreg_cli-1.0.0/data/mreg-cli.conf +7 -0
  16. mreg_cli-1.0.0/mreg_cli/__about__.py +7 -0
  17. mreg_cli-1.0.0/mreg_cli/__init__.py +5 -0
  18. mreg_cli-1.0.0/mreg_cli/__main__.py +8 -0
  19. mreg_cli-1.0.0/mreg_cli/_version.py +16 -0
  20. mreg_cli-1.0.0/mreg_cli/api/__init__.py +7 -0
  21. mreg_cli-1.0.0/mreg_cli/api/abstracts.py +486 -0
  22. mreg_cli-1.0.0/mreg_cli/api/endpoints.py +130 -0
  23. mreg_cli-1.0.0/mreg_cli/api/fields.py +104 -0
  24. mreg_cli-1.0.0/mreg_cli/api/history.py +152 -0
  25. mreg_cli-1.0.0/mreg_cli/api/models.py +3416 -0
  26. mreg_cli-1.0.0/mreg_cli/cli.py +382 -0
  27. mreg_cli-1.0.0/mreg_cli/commands/__init__.py +1 -0
  28. mreg_cli-1.0.0/mreg_cli/commands/base.py +62 -0
  29. mreg_cli-1.0.0/mreg_cli/commands/dhcp.py +136 -0
  30. mreg_cli-1.0.0/mreg_cli/commands/group.py +326 -0
  31. mreg_cli-1.0.0/mreg_cli/commands/help.py +77 -0
  32. mreg_cli-1.0.0/mreg_cli/commands/host.py +54 -0
  33. mreg_cli-1.0.0/mreg_cli/commands/host_submodules/__init__.py +28 -0
  34. mreg_cli-1.0.0/mreg_cli/commands/host_submodules/a_aaaa.py +452 -0
  35. mreg_cli-1.0.0/mreg_cli/commands/host_submodules/bacnet.py +126 -0
  36. mreg_cli-1.0.0/mreg_cli/commands/host_submodules/cname.py +166 -0
  37. mreg_cli-1.0.0/mreg_cli/commands/host_submodules/core.py +507 -0
  38. mreg_cli-1.0.0/mreg_cli/commands/host_submodules/rr.py +973 -0
  39. mreg_cli-1.0.0/mreg_cli/commands/label.py +146 -0
  40. mreg_cli-1.0.0/mreg_cli/commands/logging.py +112 -0
  41. mreg_cli-1.0.0/mreg_cli/commands/network.py +516 -0
  42. mreg_cli-1.0.0/mreg_cli/commands/permission.py +202 -0
  43. mreg_cli-1.0.0/mreg_cli/commands/policy.py +519 -0
  44. mreg_cli-1.0.0/mreg_cli/commands/recording.py +59 -0
  45. mreg_cli-1.0.0/mreg_cli/commands/registry.py +56 -0
  46. mreg_cli-1.0.0/mreg_cli/commands/root.py +58 -0
  47. mreg_cli-1.0.0/mreg_cli/commands/zone.py +288 -0
  48. mreg_cli-1.0.0/mreg_cli/config.py +253 -0
  49. mreg_cli-1.0.0/mreg_cli/errorbuilder.py +193 -0
  50. mreg_cli-1.0.0/mreg_cli/exceptions.py +237 -0
  51. mreg_cli-1.0.0/mreg_cli/help_formatter.py +38 -0
  52. mreg_cli-1.0.0/mreg_cli/main.py +238 -0
  53. mreg_cli-1.0.0/mreg_cli/outputmanager.py +466 -0
  54. mreg_cli-1.0.0/mreg_cli/py.typed +0 -0
  55. mreg_cli-1.0.0/mreg_cli/tags.txt +55 -0
  56. mreg_cli-1.0.0/mreg_cli/tokenfile.py +89 -0
  57. mreg_cli-1.0.0/mreg_cli/types.py +160 -0
  58. mreg_cli-1.0.0/mreg_cli/utilities/__init__.py +5 -0
  59. mreg_cli-1.0.0/mreg_cli/utilities/api.py +595 -0
  60. mreg_cli-1.0.0/mreg_cli/utilities/shared.py +65 -0
  61. mreg_cli-1.0.0/mreg_cli/utilities/validators.py +19 -0
  62. mreg_cli-1.0.0/mreg_cli.egg-info/PKG-INFO +1079 -0
  63. mreg_cli-1.0.0/mreg_cli.egg-info/SOURCES.txt +71 -0
  64. mreg_cli-1.0.0/mreg_cli.egg-info/dependency_links.txt +1 -0
  65. mreg_cli-1.0.0/mreg_cli.egg-info/entry_points.txt +2 -0
  66. mreg_cli-1.0.0/mreg_cli.egg-info/requires.txt +13 -0
  67. mreg_cli-1.0.0/mreg_cli.egg-info/top_level.txt +1 -0
  68. mreg_cli-1.0.0/pyproject.toml +213 -0
  69. mreg_cli-1.0.0/requirements-dev.txt +78 -0
  70. mreg_cli-1.0.0/requirements.txt +34 -0
  71. mreg_cli-1.0.0/run.py +21 -0
  72. mreg_cli-1.0.0/setup.cfg +4 -0
  73. mreg_cli-1.0.0/tox.ini +50 -0
@@ -0,0 +1,128 @@
1
+ name: build mreg-cli
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '[0-9]+.[0-9]+.[0-9]+**'
7
+
8
+ concurrency:
9
+ group: build-mreg-cli-${{ github.head_ref }}
10
+
11
+ jobs:
12
+ build_pypi:
13
+ name: Build wheels and source distribution
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#determining-when-to-use-contexts
20
+ - name: Exit if not on master branch
21
+ if: ${{ github.ref == 'refs/heads/main' }}
22
+ run: exit -1
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v2
26
+
27
+ - name: Set up Python 3.12
28
+ run: uv python install 3.12
29
+
30
+ - name: Install build dependencies
31
+ run: |
32
+ uv venv
33
+ uv pip install --upgrade build
34
+
35
+ - name: Build source distribution
36
+ run: uv run python -m build
37
+
38
+ - uses: actions/upload-artifact@v4
39
+ with:
40
+ name: pypi_artifacts
41
+ path: dist/*
42
+ if-no-files-found: error
43
+
44
+ build_pyinstaller:
45
+ name: Build pyinstaller binary
46
+ strategy:
47
+ matrix:
48
+ os: [ubuntu-latest, windows-latest, macos-latest]
49
+ python-version:
50
+ - '3.12'
51
+ include:
52
+ - os: ubuntu-latest
53
+ container: centos:8
54
+ runs-on: ${{ matrix.os }}
55
+ container: ${{ matrix.container }}
56
+
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+
60
+ - name: Install uv
61
+ uses: astral-sh/setup-uv@v2
62
+
63
+ - name: Set up Python ${{ matrix.python-version }}
64
+ run: uv python install ${{ matrix.python-version }}
65
+
66
+ - name: Run PyInstaller with Tox
67
+ run: |
68
+ uv venv
69
+ uv pip install tox-uv tox-gh-actions
70
+ tox
71
+
72
+ - name: Rename binary
73
+ run: |
74
+ mv dist/mreg-cli${{ contains(matrix.os, 'windows') && '.exe' || '' }} dist/mreg-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
75
+
76
+ - uses: actions/upload-artifact@v4
77
+ with:
78
+ name: mreg-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
79
+ path: dist/mreg-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
80
+ if-no-files-found: error
81
+
82
+ publish_pypi:
83
+ name: Publish PyPI release
84
+ needs:
85
+ - build_pypi
86
+ runs-on: ubuntu-latest
87
+ permissions:
88
+ id-token: write
89
+ steps:
90
+ - uses: actions/download-artifact@v4
91
+ with:
92
+ name: pypi_artifacts
93
+ path: dist
94
+
95
+ - name: Push build artifacts to PyPI
96
+ uses: pypa/gh-action-pypi-publish@v1.8.14
97
+
98
+ publish_github:
99
+ name: Publish GitHub release
100
+ needs:
101
+ - build_pypi
102
+ - build_pyinstaller
103
+ runs-on: ubuntu-latest
104
+
105
+ steps:
106
+ - name: Download PyInstaller binaries
107
+ uses: actions/download-artifact@v4
108
+ with:
109
+ pattern: mreg-cli-*
110
+ path: dist
111
+ merge-multiple: true
112
+
113
+ - name: Download wheel and source distributions
114
+ uses: actions/download-artifact@v4
115
+ with:
116
+ pattern: pypi_artifacts
117
+ path: dist
118
+ merge-multiple: true
119
+
120
+ - name: Create GitHub release
121
+ uses: softprops/action-gh-release@v2
122
+ with:
123
+ files: dist/*
124
+ body: |
125
+ Release ${{ github.ref_name }}
126
+ draft: false
127
+ prerelease: false
128
+
@@ -0,0 +1,54 @@
1
+ on: [push, pull_request]
2
+
3
+
4
+ name: CI
5
+ jobs:
6
+ test:
7
+ name: Integration
8
+ runs-on: ${{ matrix.os }}
9
+ strategy:
10
+ matrix:
11
+ os: [ubuntu-22.04]
12
+ python-version:
13
+ - '3.11'
14
+ - '3.12'
15
+ env:
16
+ # Disable colors and formatting in Rich console output
17
+ TERM: dumb
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v2
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ run: uv python install ${{ matrix.python-version }}
25
+ - name: Install mreg-cli
26
+ run: |
27
+ uv venv
28
+ uv pip install -e .[dev]
29
+ - name: Test and compare api calls
30
+ run: uv run ci/run_testsuite_and_record.sh
31
+
32
+ tox:
33
+ name: tox
34
+ runs-on: ubuntu-latest
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ python-version:
39
+ - "3.11"
40
+ - "3.12"
41
+
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - name: Install uv
45
+ uses: astral-sh/setup-uv@v2
46
+ - name: Set up Python ${{ matrix.python-version }}
47
+ run: uv python install ${{ matrix.python-version }}
48
+ - name: Install dependencies
49
+ run: |
50
+ uv venv
51
+ uv pip install tox-uv tox-gh-actions
52
+ - name: Test with tox
53
+ run: uv run tox r
54
+
@@ -0,0 +1,112 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+ MANIFEST
27
+ mreg_cli/_version.py
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ ci/new_testsuite_log.json
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+
61
+ # Flask stuff:
62
+ instance/
63
+ .webassets-cache
64
+
65
+ # Scrapy stuff:
66
+ .scrapy
67
+
68
+ # Sphinx documentation
69
+ docs/_build/
70
+
71
+ # PyBuilder
72
+ target/
73
+
74
+ # Jupyter Notebook
75
+ .ipynb_checkpoints
76
+
77
+ # pyenv
78
+ .python-version
79
+
80
+ # celery beat schedule file
81
+ celerybeat-schedule
82
+
83
+ # SageMath parsed files
84
+ *.sage.py
85
+
86
+ # Environments
87
+ .env
88
+ .venv
89
+ env/
90
+ venv/
91
+ ENV/
92
+ env.bak/
93
+ venv.bak/
94
+
95
+ # Spyder project settings
96
+ .spyderproject
97
+ .spyproject
98
+
99
+ # Rope project settings
100
+ .ropeproject
101
+
102
+ # mkdocs documentation
103
+ /site
104
+
105
+ # mypy
106
+ .mypy_cache/
107
+
108
+ # PyCharm
109
+ .idea/*
110
+ mreg/.idea
111
+
112
+ *.log
mreg_cli-1.0.0/AUTHORS ADDED
@@ -0,0 +1,12 @@
1
+ Dmytro Karpenko
2
+ Fredrik Larsen
3
+ Magnus Hirth
4
+ Marius Bakke
5
+ Nico
6
+ Nils Hiorth
7
+ Paal Braathen
8
+ Peder Hovdan Andresen
9
+ Safet Amedov
10
+ Terje Kvernes
11
+ Øyvind Hagberg
12
+ Øyvind Kolbu
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ The big Pydantic update. The entire codebase has been rewritten to use Pydantic for request and response validation. This brings with it a huge improvement to the development experience and the robustness of the code.
11
+
12
+ ### Added
13
+
14
+ - `--version` option to display current application version and exit.
15
+ Version number is in the form of `major.minor.patch` if installed from a published version.
16
+ Shows a version number including the commit hash if installed from a git repository in the form of `major.minor.patch.dev123+gabc1234`.
17
+ See [Default versioning scheme](https://setuptools-scm.readthedocs.io/en/latest/usage/#default-versioning-scheme) in the [setuptools_scm](https://github.com/pypa/setuptools_scm/) documentation for more information.
18
+ - The version can be accessed programmatically with `mreg_cli.__version__`.
19
+ - `label set_description` command to set the description of a label.
20
+ - `network list_excluded_ranges` command to list the excluded ranges of a network.
21
+ - Application can now store tokens for multiple servers and will pick the correct one based on the server URL.
22
+ - Building binaries for Windows, Linux and MacOS, and publishing the package to PyPI on each GitHub release.
23
+
24
+ ### Changed
25
+
26
+ - The application now uses Pydantic internally to validate request and response data. This should make the code more robust and easier to maintain.
27
+ - Application now attempts to send JSON for every request. This should improve the consistency of the API responses.
28
+ - Version now follows Semantic Versioning 2.0.0 and is automatically determined based on the most recent git tag (`mreg-cli-v*`). As part of this change, the verison has been bumped from 0.9.10 to 1.0.0. See the Added section for more information on how version numbers are accessed.
29
+
30
+ ### Removed
31
+
32
+ - `label rename -desc` option. Description modification is now done through the new `label set_description` command.
33
+
34
+ ### Fixed
35
+
36
+ - Hopefully more than we broke.
@@ -0,0 +1,38 @@
1
+ # Contributing
2
+
3
+ If you would like to contribute to this project, please follow these steps:
4
+
5
+ 1. Fork the repository
6
+ 2. Create a new branch (`git checkout -b feature/branch-name`)
7
+ 3. Make changes
8
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
9
+ 5. Push to the branch (`git push origin feature/branch-name`)
10
+ 6. Create a Pull Request
11
+
12
+ ## Publishing
13
+
14
+ Publishing new versions is automatically handled by GitHub actions for versions tagged with `x.y.z[.prerelease]` (`1.2.3`, `1.2.3.rc1`, etc.). If you are a maintainer, you can create a new release by following these steps:
15
+
16
+ 1. Switch to the `master` branch:
17
+
18
+ ```bash
19
+ git checkout master
20
+ ```
21
+
22
+ 2. Create a new tag:
23
+
24
+ ```bash
25
+ git tag 1.2.3
26
+ ```
27
+
28
+ 3. Push the tag to the upstream repository:
29
+
30
+ ```bash
31
+ git push upstream 1.2.3
32
+ ```
33
+
34
+ To push a tag together with a new commit:
35
+
36
+ ```bash
37
+ git push upstream master --tags
38
+ ```