mreg-cli 1.0.1__tar.gz → 1.2.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.
- mreg_cli-1.2.0/.github/workflows/publish.yml +201 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/.github/workflows/test.yml +16 -10
- mreg_cli-1.2.0/.markdownlint.json +9 -0
- mreg_cli-1.2.0/CHANGELOG.md +79 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/PKG-INFO +60 -24
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/README.md +57 -10
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/ci/testsuite +1 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/ci/testsuite-result.json +122 -1
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/data/mreg-cli.conf +1 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/_version.py +2 -2
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/api/endpoints.py +7 -0
- mreg_cli-1.2.0/mreg_cli/api/fields.py +122 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/api/history.py +1 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/api/models.py +337 -66
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/cli.py +1 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/dhcp.py +2 -4
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/help.py +51 -2
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host_submodules/a_aaaa.py +13 -20
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host_submodules/core.py +56 -22
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host_submodules/rr.py +6 -22
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/network.py +16 -16
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/permission.py +2 -2
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/config.py +48 -12
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/errorbuilder.py +17 -15
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/exceptions.py +16 -11
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/main.py +27 -47
- mreg_cli-1.2.0/mreg_cli/prompt.py +117 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/tokenfile.py +7 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/utilities/api.py +8 -5
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli.egg-info/PKG-INFO +60 -24
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli.egg-info/SOURCES.txt +8 -3
- mreg_cli-1.2.0/mreg_cli.egg-info/requires.txt +7 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/pyproject.toml +14 -8
- mreg_cli-1.2.0/tests/api/test_fields.py +144 -0
- mreg_cli-1.2.0/tests/api/test_models.py +113 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/tests/conftest.py +18 -0
- mreg_cli-1.2.0/tests/test_errorbuilder.py +64 -0
- mreg_cli-1.2.0/tests/test_prompt.py +122 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/tests/test_tokenfile.py +34 -0
- mreg_cli-1.2.0/tests/utilities/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/tests/utilities/test_api.py +28 -4
- mreg_cli-1.2.0/uv.lock +895 -0
- mreg_cli-1.0.1/.github/workflows/publish.yml +0 -136
- mreg_cli-1.0.1/CHANGELOG +0 -36
- mreg_cli-1.0.1/mreg_cli/api/fields.py +0 -104
- mreg_cli-1.0.1/mreg_cli.egg-info/requires.txt +0 -20
- mreg_cli-1.0.1/requirements-dev.txt +0 -78
- mreg_cli-1.0.1/requirements.txt +0 -34
- mreg_cli-1.0.1/tests/test_errorbuilder.py +0 -56
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/.gitignore +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/AUTHORS +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/CONTRIBUTING +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/LICENSE +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/ci/diff.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/ci/docker-compose.yml +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/ci/run_testsuite_and_record.sh +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/__about__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/__main__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/api/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/api/abstracts.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/base.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/group.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host_submodules/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host_submodules/bacnet.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/host_submodules/cname.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/label.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/logging.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/policy.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/recording.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/registry.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/root.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/commands/zone.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/help_formatter.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/outputmanager.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/py.typed +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/tags.txt +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/types.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/utilities/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/utilities/shared.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli/utilities/validators.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli.egg-info/dependency_links.txt +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli.egg-info/entry_points.txt +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/mreg_cli.egg-info/top_level.txt +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/run.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/setup.cfg +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/tests/__init__.py +0 -0
- {mreg_cli-1.0.1/tests/utilities → mreg_cli-1.2.0/tests/api}/__init__.py +0 -0
- {mreg_cli-1.0.1 → mreg_cli-1.2.0}/tox.ini +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
env:
|
|
12
|
+
UV_FROZEN: 1
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build_pypi:
|
|
16
|
+
name: Build wheels and source distribution
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#determining-when-to-use-contexts
|
|
23
|
+
- name: Exit if not on master branch
|
|
24
|
+
if: ${{ github.ref == 'refs/heads/master' }}
|
|
25
|
+
run: exit -1
|
|
26
|
+
|
|
27
|
+
- name: Install uv
|
|
28
|
+
uses: astral-sh/setup-uv@v2
|
|
29
|
+
|
|
30
|
+
- name: Set up Python 3.12
|
|
31
|
+
run: uv python install 3.12
|
|
32
|
+
|
|
33
|
+
- name: Install build dependencies
|
|
34
|
+
run: uv sync
|
|
35
|
+
|
|
36
|
+
- name: Build source distribution
|
|
37
|
+
run: uv build
|
|
38
|
+
|
|
39
|
+
- uses: actions/upload-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: pypi_artifacts
|
|
42
|
+
path: dist/*
|
|
43
|
+
if-no-files-found: error
|
|
44
|
+
|
|
45
|
+
build_pyinstaller:
|
|
46
|
+
name: Build pyinstaller binary
|
|
47
|
+
strategy:
|
|
48
|
+
matrix:
|
|
49
|
+
os:
|
|
50
|
+
- ubuntu-latest
|
|
51
|
+
- windows-latest
|
|
52
|
+
- macos-13 # only non-large x86 macOS runner image available
|
|
53
|
+
- macos-latest
|
|
54
|
+
include:
|
|
55
|
+
- os: ubuntu-latest
|
|
56
|
+
platform: linux-x86_64
|
|
57
|
+
container: redhat/ubi8:latest
|
|
58
|
+
- os: windows-latest
|
|
59
|
+
platform: win-x86_64
|
|
60
|
+
- os: macos-13
|
|
61
|
+
platform: macos-x86_64
|
|
62
|
+
- os: macos-latest
|
|
63
|
+
platform: macos-arm64
|
|
64
|
+
python-version:
|
|
65
|
+
- '3.12'
|
|
66
|
+
runs-on: ${{ matrix.os }}
|
|
67
|
+
container: ${{ matrix.container }}
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- name: Install RHEL 8 dependencies
|
|
71
|
+
if: contains(matrix.container, 'redhat/ubi8')
|
|
72
|
+
run: dnf install -y git binutils
|
|
73
|
+
|
|
74
|
+
- name: Ensure git is available
|
|
75
|
+
run: git --version
|
|
76
|
+
|
|
77
|
+
- uses: actions/checkout@v4
|
|
78
|
+
|
|
79
|
+
- name: Install uv
|
|
80
|
+
uses: astral-sh/setup-uv@v2
|
|
81
|
+
|
|
82
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
83
|
+
run: uv python install ${{ matrix.python-version }}
|
|
84
|
+
|
|
85
|
+
- name: Install build dependencies
|
|
86
|
+
run: uv sync --group ci
|
|
87
|
+
|
|
88
|
+
- name: Run PyInstaller with Tox
|
|
89
|
+
run: uv run tox
|
|
90
|
+
|
|
91
|
+
- name: Set platform binary names
|
|
92
|
+
shell: bash
|
|
93
|
+
run: |
|
|
94
|
+
VERSION="${{ github.ref_name }}"
|
|
95
|
+
BASE_NAME="mreg-cli-${VERSION}-${{ matrix.platform }}"
|
|
96
|
+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
|
97
|
+
echo "BINARY_NAME=${BASE_NAME}.exe" >> $GITHUB_ENV
|
|
98
|
+
echo "SOURCE_NAME=dist/mreg-cli.exe" >> $GITHUB_ENV
|
|
99
|
+
else
|
|
100
|
+
echo "BINARY_NAME=${BASE_NAME}" >> $GITHUB_ENV
|
|
101
|
+
echo "SOURCE_NAME=dist/mreg-cli" >> $GITHUB_ENV
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
- name: Rename binary
|
|
105
|
+
shell: bash
|
|
106
|
+
run: mv "${{ env.SOURCE_NAME }}" "dist/${{ env.BINARY_NAME }}"
|
|
107
|
+
|
|
108
|
+
- uses: actions/upload-artifact@v4
|
|
109
|
+
with:
|
|
110
|
+
name: ${{ env.BINARY_NAME }}
|
|
111
|
+
path: dist/${{ env.BINARY_NAME }}
|
|
112
|
+
if-no-files-found: error
|
|
113
|
+
|
|
114
|
+
publish_pypi:
|
|
115
|
+
name: Publish PyPI release
|
|
116
|
+
needs:
|
|
117
|
+
- build_pypi
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
permissions:
|
|
120
|
+
id-token: write
|
|
121
|
+
steps:
|
|
122
|
+
- uses: actions/download-artifact@v4
|
|
123
|
+
with:
|
|
124
|
+
name: pypi_artifacts
|
|
125
|
+
path: dist
|
|
126
|
+
|
|
127
|
+
- name: Push build artifacts to PyPI
|
|
128
|
+
uses: pypa/gh-action-pypi-publish@v1.8.14
|
|
129
|
+
|
|
130
|
+
publish_github:
|
|
131
|
+
name: Publish GitHub release
|
|
132
|
+
needs:
|
|
133
|
+
- build_pyinstaller
|
|
134
|
+
- publish_pypi
|
|
135
|
+
runs-on: ubuntu-latest
|
|
136
|
+
|
|
137
|
+
steps:
|
|
138
|
+
- name: Download PyInstaller binaries
|
|
139
|
+
uses: actions/download-artifact@v4
|
|
140
|
+
with:
|
|
141
|
+
pattern: mreg-cli-*
|
|
142
|
+
path: dist
|
|
143
|
+
merge-multiple: true
|
|
144
|
+
|
|
145
|
+
- name: Download wheel and source distributions
|
|
146
|
+
uses: actions/download-artifact@v4
|
|
147
|
+
with:
|
|
148
|
+
pattern: pypi_artifacts
|
|
149
|
+
path: dist
|
|
150
|
+
merge-multiple: true
|
|
151
|
+
|
|
152
|
+
- name: Generate SHA256 checksums
|
|
153
|
+
id: sha
|
|
154
|
+
run: |
|
|
155
|
+
cd dist
|
|
156
|
+
echo "checksums<<EOF" >> $GITHUB_OUTPUT
|
|
157
|
+
sha256sum * >> $GITHUB_OUTPUT
|
|
158
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
159
|
+
|
|
160
|
+
- name: Create GitHub release
|
|
161
|
+
uses: softprops/action-gh-release@v2
|
|
162
|
+
with:
|
|
163
|
+
files: dist/*
|
|
164
|
+
body: |
|
|
165
|
+
Release ${{ github.ref_name }}
|
|
166
|
+
|
|
167
|
+
## Binary Downloads
|
|
168
|
+
|
|
169
|
+
Platform | Architecture | Download
|
|
170
|
+
---------|--------------|----------
|
|
171
|
+
Linux | x86_64 | [mreg-cli-${{ github.ref_name }}-linux-x86_64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-linux-x86_64)
|
|
172
|
+
Windows | x86_64 | [mreg-cli-${{ github.ref_name }}-win-x86_64.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-win-x86_64.exe)
|
|
173
|
+
macOS | x86_64 | [mreg-cli-${{ github.ref_name }}-macos-x86_64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-macos-x86_64)
|
|
174
|
+
macOS | ARM64 | [mreg-cli-${{ github.ref_name }}-macos-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-macos-arm64)
|
|
175
|
+
|
|
176
|
+
## PyPI Package
|
|
177
|
+
|
|
178
|
+
### uv
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
uv tool install mreg-cli==${{ github.ref_name }}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### pipx
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
pipx install mreg-cli==${{ github.ref_name }}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### pip
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pip install mreg-cli==${{ github.ref_name }}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## SHA256 Checksums
|
|
197
|
+
```
|
|
198
|
+
${{ steps.sha.outputs.checksums }}
|
|
199
|
+
```
|
|
200
|
+
draft: false
|
|
201
|
+
prerelease: false
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
on: [push, pull_request]
|
|
2
2
|
|
|
3
|
+
env:
|
|
4
|
+
UV_FROZEN: 1
|
|
3
5
|
|
|
4
6
|
name: CI
|
|
5
7
|
jobs:
|
|
@@ -23,9 +25,7 @@ jobs:
|
|
|
23
25
|
- name: Set up Python ${{ matrix.python-version }}
|
|
24
26
|
run: uv python install ${{ matrix.python-version }}
|
|
25
27
|
- name: Install mreg-cli
|
|
26
|
-
run:
|
|
27
|
-
uv venv
|
|
28
|
-
uv pip install -e .[dev]
|
|
28
|
+
run: uv sync
|
|
29
29
|
- name: Test and compare api calls
|
|
30
30
|
run: uv run ci/run_testsuite_and_record.sh
|
|
31
31
|
|
|
@@ -45,12 +45,20 @@ jobs:
|
|
|
45
45
|
- name: Set up Python ${{ matrix.python-version }}
|
|
46
46
|
run: uv python install ${{ matrix.python-version }}
|
|
47
47
|
- name: Install dependencies
|
|
48
|
-
run:
|
|
49
|
-
uv venv
|
|
50
|
-
uv pip install tox-uv tox-gh-actions
|
|
48
|
+
run: uv sync --group ci
|
|
51
49
|
- name: Test building with tox
|
|
52
50
|
run: uv run tox r
|
|
53
|
-
|
|
51
|
+
|
|
52
|
+
lint:
|
|
53
|
+
name: Lint
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- uses: DavidAnson/markdownlint-cli2-action@v18
|
|
58
|
+
with:
|
|
59
|
+
config: '.markdownlint.json'
|
|
60
|
+
globs: '**/*.md'
|
|
61
|
+
|
|
54
62
|
unit:
|
|
55
63
|
name: Unit tests
|
|
56
64
|
runs-on: ubuntu-latest
|
|
@@ -67,8 +75,6 @@ jobs:
|
|
|
67
75
|
- name: Set up Python ${{ matrix.python-version }}
|
|
68
76
|
run: uv python install ${{ matrix.python-version }}
|
|
69
77
|
- name: Install dependencies
|
|
70
|
-
run:
|
|
71
|
-
uv venv
|
|
72
|
-
uv pip install -U -e ".[test]"
|
|
78
|
+
run: uv sync
|
|
73
79
|
- name: Run unittest
|
|
74
80
|
run: uv run pytest
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
## [1.2.0](https://github.com/unioslo/mreg-cli/releases/tag/1.2.0) - 2024-11-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Support for `help versions` which shows versions of the CLI and the server for servers that have implemented the `/meta/version` (and `/meta/libraries` endpoints for superusers).
|
|
15
|
+
- Support for `help whoami` which shows information about the current user as the server sees them. This includes the username, attributes, groups, and permissions. This command is only available if the server has implemented the `/meta/users` endpoint.
|
|
16
|
+
- Support for `help whois <username>` which allows elevated users to see information about the given user. Also requires the `/meta/users` endpoint to be implemented on the server.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- REPL command completion not showing descriptions for commands.
|
|
21
|
+
- `host info` with MAC address argument not working for hosts with multiple IPs associated with the same MAC address.
|
|
22
|
+
- Failed token file write causing the application to crash.
|
|
23
|
+
- Connection strings without domains and with ports are now parsed properly for prompt interpolation.
|
|
24
|
+
|
|
25
|
+
## [1.1.0](https://github.com/unioslo/mreg-cli/releases/tag/1.1.0) - 2024-11-19
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Customizable prompt with string interpolation. The prompt can be customized with the `--prompt` option or with the `prompt` option in the config. The prompt can be customized with the following variables:
|
|
30
|
+
- `{user}`: Username of active user
|
|
31
|
+
- `{proto}`: Protocol part of the server URL
|
|
32
|
+
- `{host}`: Host/domain name part of the server URL
|
|
33
|
+
- `{port}`: Port part of the server URL (if any)
|
|
34
|
+
- `{domain}`: Domain name. Defaults to `uio.no` if not specified.
|
|
35
|
+
Uses the domain specified with `--domain` or the `domain` option in the config.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- MAC adress validation. Now supports all common formats. See the [Pydantic docs](https://docs.pydantic.dev/latest/api/pydantic_extra_types_mac_address/) for more information.
|
|
40
|
+
- `host add`: Re-introduced support for network/IP ending with `/`.
|
|
41
|
+
- Automatically deduces the correct network to assign an IP from.
|
|
42
|
+
- `host add`: No longer possible to assign network address (first address of subnet) or broadcast address (last address of subnet) to a host.
|
|
43
|
+
|
|
44
|
+
## [1.0.1](https://github.com/unioslo/mreg-cli/releases/tag/1.0.1) - 2024-10-21
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- Rendering of top level command autocompletion in REPL.
|
|
49
|
+
- `OK:` messages not being displayed outside of `--record` mode
|
|
50
|
+
|
|
51
|
+
## [1.0.0](https://github.com/unioslo/mreg-cli/releases/tag/1.0.0) - 2024-10-12
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- `--version` option to display current application version and exit.
|
|
58
|
+
Version number is in the form of `major.minor.patch` if installed from a published version.
|
|
59
|
+
Shows a version number including the commit hash if installed from a git repository in the form of `major.minor.patch.dev123+gabc1234`.
|
|
60
|
+
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.
|
|
61
|
+
- The version can be accessed programmatically with `mreg_cli.__version__`.
|
|
62
|
+
- `label set_description` command to set the description of a label.
|
|
63
|
+
- `network list_excluded_ranges` command to list the excluded ranges of a network.
|
|
64
|
+
- Application can now store tokens for multiple servers and will pick the correct one based on the server URL.
|
|
65
|
+
- Building binaries for Windows, Linux and MacOS, and publishing the package to PyPI on each GitHub release.
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- The application now uses Pydantic internally to validate request and response data. This should make the code more robust and easier to maintain.
|
|
70
|
+
- Application now attempts to send JSON for every request. This should improve the consistency of the API responses.
|
|
71
|
+
- 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.
|
|
72
|
+
|
|
73
|
+
### Removed
|
|
74
|
+
|
|
75
|
+
- `label rename -desc` option. Description modification is now done through the new `label set_description` command.
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- Hopefully more than we broke.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mreg-cli
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: MREG interactive command line client
|
|
5
5
|
Author: Others (see AUTHORS)
|
|
6
6
|
Author-email: Øyvind Kolbu <oyvind.kolbu@usit.uio.no>, Safet A <amedov@usit.uio.no>, Magnus Hirth <mhmorgan42@gmail.com>, Nico <nicolaydmohebi@gmail.com>, Marius Bakke <marius.bakke@usit.uio.no>, Fredrik Larsen <fredrik.larsen@usit.uio.no>, Paal Braathen <paal.braathen@usit.uio.no>, Nils Hiorth <nils@nls.me>, Dmytro Karpenko <dmytrok@usit.uio.no>
|
|
@@ -699,19 +699,8 @@ Requires-Dist: prompt_toolkit>=3.0.0
|
|
|
699
699
|
Requires-Dist: requests[socks]>=2.31.0
|
|
700
700
|
Requires-Dist: typing_extensions>=4.12.0
|
|
701
701
|
Requires-Dist: pydantic[email]>=2.7.1
|
|
702
|
-
|
|
703
|
-
Requires-Dist:
|
|
704
|
-
Requires-Dist: inline-snapshot; extra == "test"
|
|
705
|
-
Requires-Dist: pytest-httpserver; extra == "test"
|
|
706
|
-
Provides-Extra: dev
|
|
707
|
-
Requires-Dist: mreg-cli[test]; extra == "dev"
|
|
708
|
-
Requires-Dist: ruff; extra == "dev"
|
|
709
|
-
Requires-Dist: tox-uv; extra == "dev"
|
|
710
|
-
Requires-Dist: rich; extra == "dev"
|
|
711
|
-
Requires-Dist: setuptools; extra == "dev"
|
|
712
|
-
Requires-Dist: setuptools-scm; extra == "dev"
|
|
713
|
-
Requires-Dist: build; extra == "dev"
|
|
714
|
-
Requires-Dist: pyinstaller; extra == "dev"
|
|
702
|
+
Requires-Dist: pydantic-extra-types>=2.1.0
|
|
703
|
+
Requires-Dist: platformdirs>=4.3.0
|
|
715
704
|
|
|
716
705
|
# MREG CLI [](https://github.com/unioslo/mreg-cli/actions/workflows/test.yml)
|
|
717
706
|
|
|
@@ -737,15 +726,7 @@ Requires-Dist: pyinstaller; extra == "dev"
|
|
|
737
726
|
- [DHCP](#dhcp)
|
|
738
727
|
- [subnet](#subnet)
|
|
739
728
|
- [zone](#zone)
|
|
740
|
-
- [history](#history)
|
|
741
729
|
- [other](#other)
|
|
742
|
-
- [Devhelp](#devhelp)
|
|
743
|
-
- [client.py](#clientpy)
|
|
744
|
-
- [commands.py](#commandspy)
|
|
745
|
-
- [util.py](#utilpy)
|
|
746
|
-
- [history.py](#historypy)
|
|
747
|
-
- [config.py](#configpy)
|
|
748
|
-
- [log.py](#logpy)
|
|
749
730
|
|
|
750
731
|
## Setup
|
|
751
732
|
|
|
@@ -753,10 +734,65 @@ Options can be set in ~/.config/mreg-cli.conf. A typical config file looks like
|
|
|
753
734
|
|
|
754
735
|
```ini
|
|
755
736
|
[mreg]
|
|
756
|
-
|
|
757
|
-
|
|
737
|
+
url=https://mreg.example.com:8000
|
|
738
|
+
user=mreg-user
|
|
758
739
|
```
|
|
759
740
|
|
|
741
|
+
<details>
|
|
742
|
+
<summary>Other options</summary>
|
|
743
|
+
|
|
744
|
+
### Prompt
|
|
745
|
+
|
|
746
|
+
The prompt text can be configured with a custom format string. The available variables are:
|
|
747
|
+
|
|
748
|
+
- `{user}`: Username of active user
|
|
749
|
+
- `{proto}`: Protocol part of the server URL
|
|
750
|
+
- `{host}`: Name part of the server URL
|
|
751
|
+
- `{port}`: Port part of the server URL (if any)
|
|
752
|
+
- `{domain}`: Domain name. Defaults to `uio.no` if not specified.
|
|
753
|
+
|
|
754
|
+
By default the prompt is set to `{user}@{host}`, which is equivalent to the following config:
|
|
755
|
+
|
|
756
|
+
```ini
|
|
757
|
+
[mreg]
|
|
758
|
+
PROMPT={user}@{host}
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
Which results in a prompt like this:
|
|
762
|
+
|
|
763
|
+
```cli
|
|
764
|
+
admin@mreg.example.com>
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
#### Command line
|
|
768
|
+
|
|
769
|
+
A custom prompt string can be specified as a command line argument as well:
|
|
770
|
+
|
|
771
|
+
```bash
|
|
772
|
+
mreg-cli --prompt "<string>"
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
#### Disabling the prompt prefix text
|
|
776
|
+
|
|
777
|
+
The prompt text can be disabled by setting it to no value in the config file or by using the `--prompt` flag with an empty string.
|
|
778
|
+
|
|
779
|
+
```ini
|
|
780
|
+
[mreg]
|
|
781
|
+
PROMPT=
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
```bash
|
|
785
|
+
mreg-cli --prompt ""
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
Which results in the following prompt:
|
|
789
|
+
|
|
790
|
+
```cli
|
|
791
|
+
>
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
</details>
|
|
795
|
+
|
|
760
796
|
## General usage
|
|
761
797
|
|
|
762
798
|
Commands in `mreg-cli` take on the form of a fairly standard command line interface:
|
|
@@ -22,15 +22,7 @@
|
|
|
22
22
|
- [DHCP](#dhcp)
|
|
23
23
|
- [subnet](#subnet)
|
|
24
24
|
- [zone](#zone)
|
|
25
|
-
- [history](#history)
|
|
26
25
|
- [other](#other)
|
|
27
|
-
- [Devhelp](#devhelp)
|
|
28
|
-
- [client.py](#clientpy)
|
|
29
|
-
- [commands.py](#commandspy)
|
|
30
|
-
- [util.py](#utilpy)
|
|
31
|
-
- [history.py](#historypy)
|
|
32
|
-
- [config.py](#configpy)
|
|
33
|
-
- [log.py](#logpy)
|
|
34
26
|
|
|
35
27
|
## Setup
|
|
36
28
|
|
|
@@ -38,10 +30,65 @@ Options can be set in ~/.config/mreg-cli.conf. A typical config file looks like
|
|
|
38
30
|
|
|
39
31
|
```ini
|
|
40
32
|
[mreg]
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
url=https://mreg.example.com:8000
|
|
34
|
+
user=mreg-user
|
|
43
35
|
```
|
|
44
36
|
|
|
37
|
+
<details>
|
|
38
|
+
<summary>Other options</summary>
|
|
39
|
+
|
|
40
|
+
### Prompt
|
|
41
|
+
|
|
42
|
+
The prompt text can be configured with a custom format string. The available variables are:
|
|
43
|
+
|
|
44
|
+
- `{user}`: Username of active user
|
|
45
|
+
- `{proto}`: Protocol part of the server URL
|
|
46
|
+
- `{host}`: Name part of the server URL
|
|
47
|
+
- `{port}`: Port part of the server URL (if any)
|
|
48
|
+
- `{domain}`: Domain name. Defaults to `uio.no` if not specified.
|
|
49
|
+
|
|
50
|
+
By default the prompt is set to `{user}@{host}`, which is equivalent to the following config:
|
|
51
|
+
|
|
52
|
+
```ini
|
|
53
|
+
[mreg]
|
|
54
|
+
PROMPT={user}@{host}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Which results in a prompt like this:
|
|
58
|
+
|
|
59
|
+
```cli
|
|
60
|
+
admin@mreg.example.com>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Command line
|
|
64
|
+
|
|
65
|
+
A custom prompt string can be specified as a command line argument as well:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
mreg-cli --prompt "<string>"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Disabling the prompt prefix text
|
|
72
|
+
|
|
73
|
+
The prompt text can be disabled by setting it to no value in the config file or by using the `--prompt` flag with an empty string.
|
|
74
|
+
|
|
75
|
+
```ini
|
|
76
|
+
[mreg]
|
|
77
|
+
PROMPT=
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
mreg-cli --prompt ""
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Which results in the following prompt:
|
|
85
|
+
|
|
86
|
+
```cli
|
|
87
|
+
>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
</details>
|
|
91
|
+
|
|
45
92
|
## General usage
|
|
46
93
|
|
|
47
94
|
Commands in `mreg-cli` take on the form of a fairly standard command line interface:
|
|
@@ -203,6 +203,7 @@ dhcp assoc foo aa:bb:cc:dd:ee:ff # should fail, the host has two IPs of differen
|
|
|
203
203
|
host aaaa_remove foo 2001:db9::5
|
|
204
204
|
host aaaa_add foo 2001:db8::5 -f
|
|
205
205
|
dhcp assoc foo aa:bb:cc:dd:ee:ff # should work, the host now has two IPs of different types on the same VLAN.
|
|
206
|
+
host info foo # should work and show both IPs
|
|
206
207
|
host remove foo -f
|
|
207
208
|
network remove 10.0.0.0/24 -f
|
|
208
209
|
network remove 2001:db8::/64 -f
|
|
@@ -20022,6 +20022,127 @@
|
|
|
20022
20022
|
],
|
|
20023
20023
|
"time": null
|
|
20024
20024
|
},
|
|
20025
|
+
{
|
|
20026
|
+
"command": "host info foo",
|
|
20027
|
+
"command_filter": null,
|
|
20028
|
+
"command_filter_negate": false,
|
|
20029
|
+
"command_issued": "host info foo # should work and show both IPs",
|
|
20030
|
+
"ok": [],
|
|
20031
|
+
"warning": [],
|
|
20032
|
+
"error": [],
|
|
20033
|
+
"output": [
|
|
20034
|
+
"Name: foo.example.org",
|
|
20035
|
+
"Contact: ",
|
|
20036
|
+
"A_Records IP MAC",
|
|
20037
|
+
" 10.0.0.5 aa:bb:cc:dd:ee:ff",
|
|
20038
|
+
"AAAA_Records IP MAC",
|
|
20039
|
+
" 2001:db8::5 <not set>",
|
|
20040
|
+
"TTL: (Default)",
|
|
20041
|
+
"TXT: v=spf1 -all",
|
|
20042
|
+
"Created: Thu Nov 21 10:34:55 2024",
|
|
20043
|
+
"Updated: Thu Nov 21 10:34:55 2024"
|
|
20044
|
+
],
|
|
20045
|
+
"api_requests": [
|
|
20046
|
+
{
|
|
20047
|
+
"method": "GET",
|
|
20048
|
+
"url": "/api/v1/hosts/foo.example.org",
|
|
20049
|
+
"data": {},
|
|
20050
|
+
"status": 200,
|
|
20051
|
+
"response": {
|
|
20052
|
+
"ipaddresses": [
|
|
20053
|
+
{
|
|
20054
|
+
"macaddress": "aa:bb:cc:dd:ee:ff",
|
|
20055
|
+
"ipaddress": "10.0.0.5",
|
|
20056
|
+
"host": 13
|
|
20057
|
+
},
|
|
20058
|
+
{
|
|
20059
|
+
"macaddress": "",
|
|
20060
|
+
"ipaddress": "2001:db8::5",
|
|
20061
|
+
"host": 13
|
|
20062
|
+
}
|
|
20063
|
+
],
|
|
20064
|
+
"cnames": [],
|
|
20065
|
+
"mxs": [],
|
|
20066
|
+
"txts": [
|
|
20067
|
+
{
|
|
20068
|
+
"txt": "v=spf1 -all",
|
|
20069
|
+
"host": 13
|
|
20070
|
+
}
|
|
20071
|
+
],
|
|
20072
|
+
"ptr_overrides": [],
|
|
20073
|
+
"hinfo": null,
|
|
20074
|
+
"loc": null,
|
|
20075
|
+
"bacnetid": null,
|
|
20076
|
+
"name": "foo.example.org",
|
|
20077
|
+
"contact": "",
|
|
20078
|
+
"ttl": null,
|
|
20079
|
+
"comment": "",
|
|
20080
|
+
"zone": 1
|
|
20081
|
+
}
|
|
20082
|
+
},
|
|
20083
|
+
{
|
|
20084
|
+
"method": "GET",
|
|
20085
|
+
"url": "/api/v1/srvs/?host=13",
|
|
20086
|
+
"data": {},
|
|
20087
|
+
"status": 200,
|
|
20088
|
+
"response": {
|
|
20089
|
+
"count": 0,
|
|
20090
|
+
"next": null,
|
|
20091
|
+
"previous": null,
|
|
20092
|
+
"results": []
|
|
20093
|
+
}
|
|
20094
|
+
},
|
|
20095
|
+
{
|
|
20096
|
+
"method": "GET",
|
|
20097
|
+
"url": "/api/v1/naptrs/?host=13",
|
|
20098
|
+
"data": {},
|
|
20099
|
+
"status": 200,
|
|
20100
|
+
"response": {
|
|
20101
|
+
"count": 0,
|
|
20102
|
+
"next": null,
|
|
20103
|
+
"previous": null,
|
|
20104
|
+
"results": []
|
|
20105
|
+
}
|
|
20106
|
+
},
|
|
20107
|
+
{
|
|
20108
|
+
"method": "GET",
|
|
20109
|
+
"url": "/api/v1/sshfps/?host=13",
|
|
20110
|
+
"data": {},
|
|
20111
|
+
"status": 200,
|
|
20112
|
+
"response": {
|
|
20113
|
+
"count": 0,
|
|
20114
|
+
"next": null,
|
|
20115
|
+
"previous": null,
|
|
20116
|
+
"results": []
|
|
20117
|
+
}
|
|
20118
|
+
},
|
|
20119
|
+
{
|
|
20120
|
+
"method": "GET",
|
|
20121
|
+
"url": "/api/v1/hostpolicy/roles/?hosts=13",
|
|
20122
|
+
"data": {},
|
|
20123
|
+
"status": 200,
|
|
20124
|
+
"response": {
|
|
20125
|
+
"count": 0,
|
|
20126
|
+
"next": null,
|
|
20127
|
+
"previous": null,
|
|
20128
|
+
"results": []
|
|
20129
|
+
}
|
|
20130
|
+
},
|
|
20131
|
+
{
|
|
20132
|
+
"method": "GET",
|
|
20133
|
+
"url": "/api/v1/hostgroups/?hosts=13",
|
|
20134
|
+
"data": {},
|
|
20135
|
+
"status": 200,
|
|
20136
|
+
"response": {
|
|
20137
|
+
"count": 0,
|
|
20138
|
+
"next": null,
|
|
20139
|
+
"previous": null,
|
|
20140
|
+
"results": []
|
|
20141
|
+
}
|
|
20142
|
+
}
|
|
20143
|
+
],
|
|
20144
|
+
"time": null
|
|
20145
|
+
},
|
|
20025
20146
|
{
|
|
20026
20147
|
"command": "host remove foo -f",
|
|
20027
20148
|
"command_filter": null,
|
|
@@ -24928,7 +25049,7 @@
|
|
|
24928
25049
|
"api_requests": [
|
|
24929
25050
|
{
|
|
24930
25051
|
"method": "GET",
|
|
24931
|
-
"url": "/api/v1/hosts/?ipaddresses__ipaddress=10.0.0.20
|
|
25052
|
+
"url": "/api/v1/hosts/?ipaddresses__ipaddress=10.0.0.20",
|
|
24932
25053
|
"data": {},
|
|
24933
25054
|
"status": 200,
|
|
24934
25055
|
"response": {
|