diff --git a/.gitignore b/.gitignore index 94746db1f46b2e09a1af6b237279ae5d4c1b1f56..faf505edd65bc1045f2a3fd35d1f3059cbda9516 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *venv* __pycache__ bot +.ruff_cache +.pytest_cache ansible_collections/paessler/prtg/tests/output/ ansible_collections/paessler/prtg/tests/integration/inventory diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c205f96db82f8425c41dfad2649cb9f9143f4aa4..6224baa15283e8b330f9f103838d0e92d9bee639 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ .RUNNER_TAGS: &RUNNER_TAGS tags: - gitlab-org-docker - image: "python:3.9.18-slim-bullseye" + image: "python:3.11.7-slim-bookworm" stages: - lint @@ -13,22 +13,25 @@ ansible-test-sanity: extends: - .RUNNER_TAGS stage: lint + before_script: + - apt-get update + - apt-get install --yes locales locales-all + - apt-get --no-install-recommends --no-install-suggests --yes install git shellcheck script: - - apt-get update && apt-get install git -y - python3 -m pip install -r ${CI_PROJECT_DIR}/requirements.txt - cd ${CI_PROJECT_DIR}/ansible_collections/paessler/prtg - echo "ready to run sanity tests" - - ansible-test sanity --python 3.9 + - LANG=en_US.UTF-8 ansible-test sanity --venv test-job: extends: - .RUNNER_TAGS stage: test script: - - apt-get update && apt-get install git -y + - apt-get update && apt-get --no-install-recommends --no-install-suggests --yes install git - python3 -m pip install -r ${CI_PROJECT_DIR}/requirements.txt - cd ${CI_PROJECT_DIR}/ansible_collections/paessler/prtg - - ansible-test units --venv --python 3.9 --coverage --requirements + - ansible-test units --venv --coverage --requirements - ansible-test integration --coverage --requirements - ansible-test coverage xml - ansible-test coverage html @@ -48,7 +51,7 @@ ansible-galaxy-build: - .RUNNER_TAGS stage: build script: - - apt-get update && apt-get install git -y + - apt-get update && apt-get --no-install-recommends --no-install-suggests --yes install git - python3 -m pip install -r ${CI_PROJECT_DIR}/requirements.txt - ansible-galaxy collection build ${CI_PROJECT_DIR}/ansible_collections/paessler/prtg artifacts: @@ -60,5 +63,7 @@ ansible-galaxy-build: extends: - .RUNNER_TAGS stage: build + needs: + - ansible-galaxy-build script: - echo "not implemented" diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 6b5d8521838c644ebb59d3a8b90e3b940f0a78fe..e092c13034beebeeed5c4cc3099f356c6db3d241 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,9 @@ { "recommendations": [ - "redhat.vscode-yaml", - "redhat.ansible" + "charliermarsh.ruff", + "ms-python.pylint", + "ms-python.python", + "redhat.ansible", + "redhat.vscode-yaml" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 5e3999b8c06d0189e7ce1e080f27e9777e470983..5c0b11610760c217463bd9f11f0729d9cd3c4164 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,14 @@ { - "python.linting.pylamaEnabled": true, - "python.linting.enabled": true, "git.ignoreLimitWarning": true, "yaml.format.enable": false, "yaml.format.bracketSpacing": false, "python.testing.pytestArgs": ["ansible_collections"], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, + "python.linting.enabled": true, "cSpell.enabled": false, "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter" + "editor.formatOnSave": true, + "editor.defaultFormatter": "charliermarsh.ruff", } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a1b51b08bc358456be2b92e15cd4ca4df6b348c5..460afae5c9703e20ef9159438f2ff405ca602050 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ The sections below outline the steps in each case. ansible-test integration --coverage --requirements ``` 1. Add your own tests (if necessary). -1. Confirm that everything is formatted using [Black](https://black.readthedocs.io/en/stable/). +1. Confirm that everything is formatted using [Ruff](https://docs.astral.sh/ruff/). 1. Update the documentation. 1. Push your feature branch to the repository. 1. Create a Merge Request; diff --git a/ansible_collections/paessler/prtg/galaxy.yml b/ansible_collections/paessler/prtg/galaxy.yml index d54edf1f88e4b7e1a0f7e90175d41b3a10db600d..b85e630c9a07b1dbfc78872046d17af4ce028c4b 100644 --- a/ansible_collections/paessler/prtg/galaxy.yml +++ b/ansible_collections/paessler/prtg/galaxy.yml @@ -62,3 +62,10 @@ issues: https://gitlab.com/PRTG/prtg-ansible/-/issues # uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry', # and '.git' are always filtered build_ignore: [] + +# A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a +# list of MANIFEST.in style +# L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key +# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive +# with 'build_ignore' +# manifest: null diff --git a/ansible_collections/paessler/prtg/meta/runtime.yml b/ansible_collections/paessler/prtg/meta/runtime.yml new file mode 100644 index 0000000000000000000000000000000000000000..2fe301c6b297df526fdaff54e491ab728887fca6 --- /dev/null +++ b/ansible_collections/paessler/prtg/meta/runtime.yml @@ -0,0 +1,52 @@ +--- +# Collections must specify a minimum required ansible version to upload +# to galaxy +requires_ansible: '>=2.9.10' + +# Content that Ansible needs to load from another location or that has +# been deprecated/removed +# plugin_routing: +# action: +# redirected_plugin_name: +# redirect: ns.col.new_location +# deprecated_plugin_name: +# deprecation: +# removal_version: "4.0.0" +# warning_text: | +# See the porting guide on how to update your playbook to +# use ns.col.another_plugin instead. +# removed_plugin_name: +# tombstone: +# removal_version: "2.0.0" +# warning_text: | +# See the porting guide on how to update your playbook to +# use ns.col.another_plugin instead. +# become: +# cache: +# callback: +# cliconf: +# connection: +# doc_fragments: +# filter: +# httpapi: +# inventory: +# lookup: +# module_utils: +# modules: +# netconf: +# shell: +# strategy: +# terminal: +# test: +# vars: + +# Python import statements that Ansible needs to load from another location +# import_redirection: +# ansible_collections.ns.col.plugins.module_utils.old_location: +# redirect: ansible_collections.ns.col.plugins.module_utils.new_location + +# Groups of actions/modules that take a common set of options +# action_groups: +# group_name: +# - module1 +# - module2 diff --git a/ansible_collections/paessler/prtg/tests/sanity/ignore-2.16.txt b/ansible_collections/paessler/prtg/tests/sanity/ignore-2.16.txt new file mode 100644 index 0000000000000000000000000000000000000000..c03a6886633f1349a6034e94868163326c7037c9 --- /dev/null +++ b/ansible_collections/paessler/prtg/tests/sanity/ignore-2.16.txt @@ -0,0 +1,2 @@ +plugins/modules/device_pause.py validate-modules:missing-gplv3-license # ignore license check +plugins/modules/device_resume.py validate-modules:missing-gplv3-license # ignore license check diff --git a/ansible_collections/paessler/prtg/tests/unit/requirements.txt b/ansible_collections/paessler/prtg/tests/unit/requirements.txt index 996dd8885591820c5c108b65c4a6df56f72158f5..76756c66373d8d99f9e57134bf8b19df7baeb2c5 100644 --- a/ansible_collections/paessler/prtg/tests/unit/requirements.txt +++ b/ansible_collections/paessler/prtg/tests/unit/requirements.txt @@ -1,3 +1,3 @@ -pytest==7.1.3 +pytest==7.4.4 mock==4.0.3 epdb diff --git a/requirements.txt b/requirements.txt index 7df8d66142e9397f384575c61ad5a2e0d7730415..961f62a1cf12a2ed16e43244ca32d26344b35811 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,4 @@ -ansible-core==2.15.4 -ansible-lint==6.20.1 -ansible==8.4.0 -black==23.9.1 -connexion==2.14.2 -openapi-spec-validator==0.6.0 -pylama==8.4.1 -pytest==7.4.2 +# common requirements file. in many cases we only need ansible +ansible-core==2.16.2 +ansible-lint==6.22.1 +ansible==9.1.0 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000000000000000000000000000000000000..d34d2f88dcf0647b7fe702a9a6aad1d50ceb62af --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,8 @@ +# This requirements file contains packages needed for development +# include default requirements +-r requirements.txt +connexion==3.0.5 +openapi-spec-validator==0.7.1 +pylint==3.0.3 +pytest==7.4.4 +ruff==0.1.11