Skip to content

Commit

Permalink
ci: Use supported ansible-lint action; run ansible-lint against the c…
Browse files Browse the repository at this point in the history
…ollection

The old ansible-community ansible-lint is deprecated.  There is a
new ansible-lint github action.  The new ansible-lint has several checks
related to ansible-test and the ignore files.  Many of our ignore settings
are not allowed any more and are required to be fixed or addressed in the
Ansible preferred way.

The python imports have to be wrapped in a try/except ImportError, and
where possible, an error must be returned from the module explaining
what was not able to be imported.

The module documentation must comply with the Ansible standards.  One
aspect of this is the `version_added` must be a valid ansible-core
version in X.Y.Z format.  Note that this version isn't really used
anywhere, so it doesn't matter for users of the role, it is purely
an `ansible-test` and import gating issue.

I created a function `generate_module_doc` which will generate the
DOCUMENTATION options section from the Ansible module_args, if
necessary.  Hopefully it won't be necessary going forward.

I fought a losing battle with flake8, pep8, etc. in ansible-test
to try to preserve the formatting in size.py - future developers
are welcome to try.

The result of this is that the .sanity files can be reduced to the
bare minimum which will greatly reduce the maintenance burden of
those files, make it easier to support newer versions of Ansible,
and make it easier to import the system roles collection into Galaxy
and Automation Hub.

The latest Ansible repo gating tests run ansible-lint against
the collection format instead of against individual roles.
We have to convert the role to collection format before running
ansible-test.

Role developers can run this locally using
`tox -e collection,ansible-lint-collection`
See linux-system-roles/tox-lsr#125

Add `---` doc start to .markdownlint.yaml

Fixed some other linter errors in some tests files.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
  • Loading branch information
richm committed Dec 15, 2023
1 parent 63247ed commit 8f13c40
Show file tree
Hide file tree
Showing 21 changed files with 413 additions and 278 deletions.
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Default state for all rules
default: true

Expand Down
20 changes: 0 additions & 20 deletions .sanity-ansible-ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
plugins/modules/blivet.py import-2.6!skip
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py import-3.9!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blivet.py validate-modules:module-invalid-version-added
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:module-invalid-version-added
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:module-invalid-version-added
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:return-syntax-error
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:module-invalid-version-added
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:module-invalid-version-added
plugins/module_utils/storage_lsr/argument_validator.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
tests/storage/scripts/generate_tests.py metaclass-boilerplate!skip
tests/storage/scripts/generate_tests.py future-import-boilerplate!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
21 changes: 0 additions & 21 deletions .sanity-ansible-ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
plugins/modules/blivet.py import-2.6!skip
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py import-3.9!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blivet.py validate-modules:module-invalid-version-added
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:module-invalid-version-added
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:module-invalid-version-added
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:return-syntax-error
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:module-invalid-version-added
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:module-invalid-version-added
plugins/module_utils/storage_lsr/argument_validator.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
plugins/module_utils/storage_lsr/size.py pylint!skip
tests/storage/scripts/generate_tests.py metaclass-boilerplate!skip
tests/storage/scripts/generate_tests.py future-import-boilerplate!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
36 changes: 0 additions & 36 deletions .sanity-ansible-ignore-2.12.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
plugins/modules/blivet.py import-2.6!skip
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py import-3.9!skip
plugins/modules/blivet.py import-3.10!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blivet.py validate-modules:module-invalid-version-added
plugins/modules/blockdev_info.py import-2.7!skip
plugins/modules/blockdev_info.py import-3.5!skip
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:module-invalid-version-added
plugins/modules/bsize.py import-2.7!skip
plugins/modules/bsize.py import-3.5!skip
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:module-invalid-version-added
plugins/modules/find_unused_disk.py import-2.7!skip
plugins/modules/find_unused_disk.py import-3.5!skip
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:return-syntax-error
plugins/modules/lvm_gensym.py import-2.7!skip
plugins/modules/lvm_gensym.py import-3.5!skip
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:module-invalid-version-added
plugins/modules/resolve_blockdev.py import-2.7!skip
plugins/modules/resolve_blockdev.py import-3.5!skip
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:module-invalid-version-added
plugins/module_utils/storage_lsr/__init__.py import-2.6!skip
plugins/module_utils/storage_lsr/__init__.py import-2.7!skip
plugins/module_utils/storage_lsr/__init__.py import-3.5!skip
plugins/module_utils/storage_lsr/argument_validator.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py import-2.7!skip
plugins/module_utils/storage_lsr/size.py import-3.5!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
plugins/module_utils/storage_lsr/size.py pylint!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
36 changes: 0 additions & 36 deletions .sanity-ansible-ignore-2.13.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
plugins/modules/blivet.py import-2.6!skip
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py import-3.9!skip
plugins/modules/blivet.py import-3.10!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blivet.py validate-modules:module-invalid-version-added
plugins/modules/blockdev_info.py import-2.7!skip
plugins/modules/blockdev_info.py import-3.5!skip
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:module-invalid-version-added
plugins/modules/bsize.py import-2.7!skip
plugins/modules/bsize.py import-3.5!skip
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:module-invalid-version-added
plugins/modules/find_unused_disk.py import-2.7!skip
plugins/modules/find_unused_disk.py import-3.5!skip
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:return-syntax-error
plugins/modules/lvm_gensym.py import-2.7!skip
plugins/modules/lvm_gensym.py import-3.5!skip
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:module-invalid-version-added
plugins/modules/resolve_blockdev.py import-2.7!skip
plugins/modules/resolve_blockdev.py import-3.5!skip
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:module-invalid-version-added
plugins/module_utils/storage_lsr/__init__.py import-2.6!skip
plugins/module_utils/storage_lsr/__init__.py import-2.7!skip
plugins/module_utils/storage_lsr/__init__.py import-3.5!skip
plugins/module_utils/storage_lsr/argument_validator.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py import-2.7!skip
plugins/module_utils/storage_lsr/size.py import-3.5!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
plugins/module_utils/storage_lsr/size.py pylint!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
33 changes: 0 additions & 33 deletions .sanity-ansible-ignore-2.14.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py import-3.9!skip
plugins/modules/blivet.py import-3.10!skip
plugins/modules/blivet.py import-3.11!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blivet.py validate-modules:module-invalid-version-added
plugins/modules/blockdev_info.py import-2.7!skip
plugins/modules/blockdev_info.py import-3.5!skip
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:module-invalid-version-added
plugins/modules/bsize.py import-2.7!skip
plugins/modules/bsize.py import-3.5!skip
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:module-invalid-version-added
plugins/modules/find_unused_disk.py import-2.7!skip
plugins/modules/find_unused_disk.py import-3.5!skip
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:return-syntax-error
plugins/modules/lvm_gensym.py import-2.7!skip
plugins/modules/lvm_gensym.py import-3.5!skip
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:module-invalid-version-added
plugins/modules/resolve_blockdev.py import-2.7!skip
plugins/modules/resolve_blockdev.py import-3.5!skip
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:module-invalid-version-added
plugins/module_utils/storage_lsr/__init__.py import-2.7!skip
plugins/module_utils/storage_lsr/__init__.py import-3.5!skip
plugins/module_utils/storage_lsr/size.py import-2.7!skip
plugins/module_utils/storage_lsr/size.py import-3.5!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
plugins/module_utils/storage_lsr/size.py pylint!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
33 changes: 0 additions & 33 deletions .sanity-ansible-ignore-2.15.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py import-3.9!skip
plugins/modules/blivet.py import-3.10!skip
plugins/modules/blivet.py import-3.11!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blivet.py validate-modules:module-invalid-version-added
plugins/modules/blockdev_info.py import-2.7!skip
plugins/modules/blockdev_info.py import-3.5!skip
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:module-invalid-version-added
plugins/modules/bsize.py import-2.7!skip
plugins/modules/bsize.py import-3.5!skip
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:module-invalid-version-added
plugins/modules/find_unused_disk.py import-2.7!skip
plugins/modules/find_unused_disk.py import-3.5!skip
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:return-syntax-error
plugins/modules/lvm_gensym.py import-2.7!skip
plugins/modules/lvm_gensym.py import-3.5!skip
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:module-invalid-version-added
plugins/modules/resolve_blockdev.py import-2.7!skip
plugins/modules/resolve_blockdev.py import-3.5!skip
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:module-invalid-version-added
plugins/module_utils/storage_lsr/__init__.py import-2.7!skip
plugins/module_utils/storage_lsr/__init__.py import-3.5!skip
plugins/module_utils/storage_lsr/size.py import-2.7!skip
plugins/module_utils/storage_lsr/size.py import-3.5!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
plugins/module_utils/storage_lsr/size.py pylint!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
7 changes: 7 additions & 0 deletions .sanity-ansible-ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
tests/storage/scripts/generate_tests.py shebang!skip
13 changes: 0 additions & 13 deletions .sanity-ansible-ignore-2.9.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
plugins/modules/blivet.py import-2.6!skip
plugins/modules/blivet.py import-2.7!skip
plugins/modules/blivet.py import-3.5!skip
plugins/modules/blivet.py import-3.6!skip
plugins/modules/blivet.py import-3.7!skip
plugins/modules/blivet.py import-3.8!skip
plugins/modules/blivet.py validate-modules:import-error
plugins/modules/blivet.py validate-modules:missing-gplv3-license
plugins/modules/blockdev_info.py validate-modules:missing-gplv3-license
plugins/modules/bsize.py validate-modules:missing-gplv3-license
plugins/modules/find_unused_disk.py validate-modules:missing-gplv3-license
plugins/modules/lvm_gensym.py validate-modules:missing-gplv3-license
plugins/modules/resolve_blockdev.py validate-modules:missing-gplv3-license
plugins/module_utils/storage_lsr/argument_validator.py import-2.6!skip
plugins/module_utils/storage_lsr/size.py pep8!skip
tests/storage/scripts/generate_tests.py metaclass-boilerplate!skip
tests/storage/scripts/generate_tests.py future-import-boilerplate!skip
tests/storage/scripts/generate_tests.py shebang!skip
tests/storage/scripts/post-commit shebang!skip
tests/storage/scripts/pre-commit shebang!skip
Loading

0 comments on commit 8f13c40

Please sign in to comment.