mreg-cli 1.2.1__tar.gz → 1.2.3__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.1 → mreg_cli-1.2.3}/.github/workflows/test.yml +4 -8
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/CHANGELOG.md +17 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/CONTRIBUTING +4 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/PKG-INFO +1 -1
- mreg_cli-1.2.3/ci/Dockerfile +13 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/ci/diff.py +3 -3
- mreg_cli-1.2.3/ci/run_testsuite_and_record_V2.sh +88 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/ci/testsuite-result.json +2262 -133
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/_version.py +2 -2
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/api/abstracts.py +1 -0
- mreg_cli-1.2.3/mreg_cli/api/fields.py +172 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/api/history.py +1 -1
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/api/models.py +150 -178
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/cli.py +13 -4
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/dhcp.py +11 -17
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/group.py +3 -3
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/help.py +0 -1
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host_submodules/a_aaaa.py +100 -49
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host_submodules/bacnet.py +3 -3
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host_submodules/cname.py +27 -20
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host_submodules/core.py +29 -26
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host_submodules/rr.py +32 -27
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/logging.py +1 -1
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/network.py +2 -3
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/policy.py +4 -4
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/config.py +1 -1
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/exceptions.py +48 -3
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/outputmanager.py +3 -6
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/prompt.py +6 -4
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/tokenfile.py +3 -3
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/types.py +29 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/utilities/api.py +10 -2
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli.egg-info/PKG-INFO +1 -1
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli.egg-info/SOURCES.txt +5 -0
- mreg_cli-1.2.3/tests/api/test_fields.py +269 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/conftest.py +10 -0
- mreg_cli-1.2.3/tests/test_exceptions.py +175 -0
- mreg_cli-1.2.3/tests/test_outputmanager.py +98 -0
- mreg_cli-1.2.3/tests/test_types.py +15 -0
- mreg_cli-1.2.1/mreg_cli/api/fields.py +0 -137
- mreg_cli-1.2.1/tests/api/test_fields.py +0 -144
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/.github/workflows/publish.yml +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/.gitignore +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/.markdownlint.json +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/AUTHORS +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/LICENSE +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/README.md +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/ci/docker-compose.yml +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/ci/run_testsuite_and_record.sh +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/ci/testsuite +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/data/mreg-cli.conf +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/__about__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/__main__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/api/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/api/endpoints.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/base.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/host_submodules/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/label.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/permission.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/recording.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/registry.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/root.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/commands/zone.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/errorbuilder.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/help_formatter.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/main.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/py.typed +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/tags.txt +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/utilities/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/utilities/shared.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli/utilities/validators.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli.egg-info/dependency_links.txt +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli.egg-info/entry_points.txt +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli.egg-info/requires.txt +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/mreg_cli.egg-info/top_level.txt +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/pyproject.toml +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/run.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/setup.cfg +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/api/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/api/test_models.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/test_errorbuilder.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/test_prompt.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/test_tokenfile.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/utilities/__init__.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tests/utilities/test_api.py +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/tox.ini +0 -0
- {mreg_cli-1.2.1 → mreg_cli-1.2.3}/uv.lock +0 -0
|
@@ -14,20 +14,15 @@ jobs:
|
|
|
14
14
|
python-version:
|
|
15
15
|
- '3.11'
|
|
16
16
|
- '3.12'
|
|
17
|
+
- '3.13'
|
|
17
18
|
env:
|
|
18
19
|
# Disable colors and formatting in Rich console output
|
|
19
20
|
TERM: dumb
|
|
20
21
|
steps:
|
|
21
22
|
- name: Checkout
|
|
22
23
|
uses: actions/checkout@v4
|
|
23
|
-
- name: Install uv
|
|
24
|
-
uses: astral-sh/setup-uv@v2
|
|
25
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
26
|
-
run: uv python install ${{ matrix.python-version }}
|
|
27
|
-
- name: Install mreg-cli
|
|
28
|
-
run: uv sync
|
|
29
24
|
- name: Test and compare api calls
|
|
30
|
-
run:
|
|
25
|
+
run: ci/run_testsuite_and_record_V2.sh ${{ matrix.python-version }}
|
|
31
26
|
|
|
32
27
|
tox:
|
|
33
28
|
name: tox
|
|
@@ -68,6 +63,7 @@ jobs:
|
|
|
68
63
|
python-version:
|
|
69
64
|
- "3.11"
|
|
70
65
|
- "3.12"
|
|
66
|
+
- '3.13'
|
|
71
67
|
steps:
|
|
72
68
|
- uses: actions/checkout@v4
|
|
73
69
|
- name: Install uv
|
|
@@ -77,4 +73,4 @@ jobs:
|
|
|
77
73
|
- name: Install dependencies
|
|
78
74
|
run: uv sync
|
|
79
75
|
- name: Run unittest
|
|
80
|
-
run: uv run pytest
|
|
76
|
+
run: uv run pytest
|
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
<!-- ## Unreleased -->
|
|
9
9
|
|
|
10
|
+
## [1.2.3](https://github.com/unioslo/mreg-cli/releases/tag/1.2.3) - 2024-12-16
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `a_add` & `aaaa_add` `-force` option to force use an IP from a network that cannot be found in MREG.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Commands that try to find networks by IP raising a 404 error instead of a proper error message when no network can be found with the given IP.
|
|
19
|
+
|
|
20
|
+
## [1.2.2](https://github.com/unioslo/mreg-cli/releases/tag/1.2.2) - 2024-12-09
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- `dhcp assoc` and `host add` commands displaying unique constraint error instead of a proper error message when a MAC is already associated with an IP.
|
|
25
|
+
- Validation errors causing the application to crash instead of displaying a proper error message.
|
|
26
|
+
|
|
10
27
|
## [1.2.1](https://github.com/unioslo/mreg-cli/releases/tag/1.2.1) - 2024-12-02
|
|
11
28
|
|
|
12
29
|
### Fixed
|
|
@@ -9,6 +9,10 @@ If you would like to contribute to this project, please follow these steps:
|
|
|
9
9
|
5. Push to the branch (`git push origin feature/branch-name`)
|
|
10
10
|
6. Create a Pull Request
|
|
11
11
|
|
|
12
|
+
## Testing
|
|
13
|
+
|
|
14
|
+
To run tests locally, just run the script `ci/run_testsuite_and_record_V2.sh` from anywhere. The only prerequisite is a working installation of docker or podman.
|
|
15
|
+
|
|
12
16
|
## Publishing
|
|
13
17
|
|
|
14
18
|
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:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mreg-cli
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
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>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# This container image is only used temporarily for testing during a CI process.
|
|
2
|
+
FROM ubuntu:latest
|
|
3
|
+
ARG python_version=3.12
|
|
4
|
+
|
|
5
|
+
RUN apt-get -qq update
|
|
6
|
+
RUN apt-get -y install curl git >/dev/null
|
|
7
|
+
RUN curl -LsSf https://astral.sh/uv/0.5.6/install.sh | sh
|
|
8
|
+
RUN /root/.local/bin/uv self update -q
|
|
9
|
+
RUN /root/.local/bin/uv python install ${python_version}
|
|
10
|
+
COPY . /build
|
|
11
|
+
RUN cd /build; /root/.local/bin/uv sync -q
|
|
12
|
+
|
|
13
|
+
CMD cd /build/ci; /root/.local/bin/uv run bash -c 'echo "test" | mreg-cli -u test -d example.org --url http://127.0.0.1:8000 --source testsuite --record new_testsuite_log.json --record-without-timestamps -v ERROR >/dev/null'
|
|
@@ -126,7 +126,7 @@ def preprocess_json(s: str) -> str:
|
|
|
126
126
|
|
|
127
127
|
# Replace all non-deterministic values with placeholders
|
|
128
128
|
s = timestamp_pattern.sub("<TIME>", s)
|
|
129
|
-
s = datetime_str_pattern.sub("<
|
|
129
|
+
s = datetime_str_pattern.sub("<DATETIME>", s)
|
|
130
130
|
s = serial_pattern.sub("Serial: <NUMBER>", s)
|
|
131
131
|
s = mac_pattern.sub("<macaddress>", s)
|
|
132
132
|
s = ipv4_pattern.sub("<IPv4>", s)
|
|
@@ -290,8 +290,8 @@ class CommandDiffer:
|
|
|
290
290
|
new_testsuite_results.append(expected.original)
|
|
291
291
|
self.diff_unresolved += 1
|
|
292
292
|
else:
|
|
293
|
-
# No diff, keep
|
|
294
|
-
new_testsuite_results.append(
|
|
293
|
+
# No diff, keep old line
|
|
294
|
+
new_testsuite_results.append(expected.original)
|
|
295
295
|
|
|
296
296
|
# Only write back changes if we are in review mode and there are changes
|
|
297
297
|
if self.review and self.diff_resolved > 0:
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# exit immediately on error
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
# check if we have docker or podman
|
|
7
|
+
if command -v docker >/dev/null 2>&1 && ! docker 2>&1 | grep -q podman; then
|
|
8
|
+
echo "Using Docker"
|
|
9
|
+
GH_PARAMS="--ansi=never"
|
|
10
|
+
elif command -v podman >/dev/null 2>&1; then
|
|
11
|
+
echo "Using Podman"
|
|
12
|
+
GH_PARAMS="--no-ansi"
|
|
13
|
+
PODMAN=1
|
|
14
|
+
alias docker=podman
|
|
15
|
+
else
|
|
16
|
+
echo "Found neither docker nor podman."
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# clean up on exit, even if something fails
|
|
21
|
+
function cleanup {
|
|
22
|
+
set +e
|
|
23
|
+
if [[ -n "$GITHUB_ACTIONS" ]]; then
|
|
24
|
+
docker compose $GH_PARAMS down
|
|
25
|
+
else
|
|
26
|
+
docker compose down
|
|
27
|
+
fi
|
|
28
|
+
docker ps -a | grep "mreg-" | awk '{print $1}' | xargs -r docker stop
|
|
29
|
+
docker ps -a | grep "mreg-" | awk '{print $1}' | xargs -r docker rm
|
|
30
|
+
docker images | grep "mreg-" | awk '{print $1}' | xargs -r docker rmi
|
|
31
|
+
rm -f new_testsuite_log.json
|
|
32
|
+
echo "cleanup done."
|
|
33
|
+
}
|
|
34
|
+
trap cleanup EXIT
|
|
35
|
+
|
|
36
|
+
# chdir to where this script is
|
|
37
|
+
cd `dirname $0`
|
|
38
|
+
|
|
39
|
+
# get Python version from argument
|
|
40
|
+
PYTHON_VERSION=3.12
|
|
41
|
+
if [ ! -z "$1" ]; then
|
|
42
|
+
PYTHON_VERSION=$1
|
|
43
|
+
fi
|
|
44
|
+
echo "Python version $PYTHON_VERSION"
|
|
45
|
+
|
|
46
|
+
# build a container image for mreg-cli
|
|
47
|
+
docker build -f Dockerfile -t mreg-cli --build-arg python_version=$PYTHON_VERSION ..
|
|
48
|
+
|
|
49
|
+
# start mreg+postgres in containers
|
|
50
|
+
if [[ -n "$GITHUB_ACTIONS" ]]; then
|
|
51
|
+
if [[ "$PODMAN" == "1" ]]; then
|
|
52
|
+
docker compose $GH_PARAMS pull >/dev/null 2>&1
|
|
53
|
+
else
|
|
54
|
+
docker compose $GH_PARAMS pull --quiet
|
|
55
|
+
fi
|
|
56
|
+
docker compose $GH_PARAMS up -d
|
|
57
|
+
else
|
|
58
|
+
docker compose up -d
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# give mreg some time to create the database schema and start up
|
|
62
|
+
sleep 5s
|
|
63
|
+
|
|
64
|
+
# create a superuser
|
|
65
|
+
if docker exec -t mreg uv version >/dev/null; then
|
|
66
|
+
docker exec -t mreg uv run /app/manage.py create_mreg_superuser --username test --password test
|
|
67
|
+
else
|
|
68
|
+
docker exec -t mreg /app/manage.py create_mreg_superuser --username test --password test
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# test connectivity
|
|
72
|
+
#docker run --rm --tty --network host --entrypoint curl mreg-cli --head http://127.0.0.1:8000/admin/login/
|
|
73
|
+
|
|
74
|
+
# start the mreg-cli container, which will automatically run the test suite
|
|
75
|
+
echo "Running the tests..."
|
|
76
|
+
docker run --name mreg-cli --network host --tty mreg-cli
|
|
77
|
+
docker commit mreg-cli finished-mreg-tests # because inside is the file new_testsuite_log.json which we want to look at
|
|
78
|
+
|
|
79
|
+
# show a detailed diff (and review if running locally)
|
|
80
|
+
if [[ -n "$GITHUB_ACTIONS" ]]; then
|
|
81
|
+
docker run --rm --tty --entrypoint bash finished-mreg-tests -c 'cd /build/ci; /root/.local/bin/uv run diff.py testsuite-result.json new_testsuite_log.json'
|
|
82
|
+
exit $?
|
|
83
|
+
else
|
|
84
|
+
docker run -it --name finished-mreg-tests --entrypoint bash finished-mreg-tests -c 'cd /build/ci; /root/.local/bin/uv run diff.py testsuite-result.json new_testsuite_log.json --review'
|
|
85
|
+
EXITCODE=$?
|
|
86
|
+
docker cp finished-mreg-tests:/build/ci/testsuite-result.json .
|
|
87
|
+
exit $EXITCODE
|
|
88
|
+
fi
|