tox-lsr version 2.11.0 has support for collection-requirements.yml,
runqemu improvements, and support for python 3.10
python 3.7 is not used on any supported platform, so remove it
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
The network role is using `main` for the default branch, so this needs
to be used in the workflow definition.
Signed-off-by: Till Maas <opensource@till.name>
To ensure that new tests are going to be tested by the CI, only exclude
tests that are not supported instead of only included the supported
ones.
Signed-off-by: Till Maas <opensource@till.name>
Problem:
After `tests_bridge_initscripts.yml` passed, the `tests_bridge_nm.yml`
will fail with NetworkManager 1.18.
Root cause:
1. The `absent` and `down` action of initscript provider will not
remove the bridge interface which fail the assertion in
`tests_bridge_nm.yml`.
2. In initscript mode, network role will create ifcfg file with
`NM_CONTROLLED=no` instructing NetworkManager to mark the bridge as
unmanaged. The follow up `down` and `absent` action of initscript
provider will not change the NetworkManager's understanding on
unmanaged state of this interface.
Fixes:
1. We cannot change existing behaviour of initscript on not deleting
interface in `down` and `absent` action. So we change the test
function `tests/playbooks/down_profile.yml` to delete the interface
manually via `ip link del <ifname>` command.
2. Use `NM.Client.reload_connections_async()` to reload the
configuration for nm provider on NetworkManager 1.18.
Previous test infrastructure is running each test file in a brand new VM
or container which cause this problem not been found before.
Dedicate test case `tests/tests_switch_provider.yml` included.
Signed-off-by: Gris Ge <fge@redhat.com>
Use the new tox-lsr that uses ansible-core 2.12.
Use ansible-plugin-scan in CI.
Fix pylint errors found by new ansible-test pylinter.
CI test with py39
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Fix ensure_provider_tests.py so that the tests are correctly generated.
Because the generated tests have not been checked in a while, there was
some drift between the actual tests and what should have been generated,
so the new generated tests have also been included.
When `ensure_provider_tests.py` detects differences, it will now show
the diffs using a unified diff format.
Added a new tox testenv `ensure_provider_tests` - use
`tox -e ensure_provider_tests` to run - to pass arguments, use
`tox -e ensure_provider_tests -- generate`
Added `ensure_provider_tests` as one of the tox testenvs to run for
github tox CI.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Add support for using latest ansible-lint and ansible-test with
ansible-core 2.11. There are a few new warnings that need to
be addressed or suppressed.
One of the changes is to add `# noqa ignore-errors` to the places in
the role where `ignore_errors: true` is used. In general, it is not
a good idea to use `ignore_errors: true` - instead, it is better to
capture the result of the command using a `register`, then use
`failed_when`. Or, if that is not possible, use a `block`/`rescue`
for more complex error handling. However, in the case where the network
role is using `ignore_errors: true` in test code, it is acceptable.
see https://ansible-lint.readthedocs.io/en/latest/default_rules.html#ignore-errors
Another change is to have all tasks have a valid `name:`. This
is explained at https://ansible-lint.readthedocs.io/en/latest/default_rules.html#unnamed-task
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Using container to run `ansible-playbook` against localhost.
To debug it, try
```bash
sudo DEBUG=1 ./.github/run_test.sh tests_bond_nm.yml
```
Attached two container files for CentOS 8 and CentOS Stream 8.
The container image is stored under quay:
https://quay.io/organization/linux_system_roles
Only a small mount of tests has been chose in order to give stable CI
test feedback.
The github action CI will run two instances using above container image.
Signed-off-by: Gris Ge <fge@redhat.com>
The auto update is creating merge commits instead of rebasing, therefore
it is not the right choice.
This reverts commit 81a602dd71.
Signed-off-by: Till Maas <opensource@till.name>
Automation Hub, and possibly Galaxy in the future, require the
collection to be screened with `ansible-test sanity` among other
checks. The role had a number of issues:
* Use `AssertionError` instead of `assert`
* Use of `logging` module not in accordance with standards, but these
are ok and the errors were suppressed
* Several import errors which are ok because they are checked
elsewhere
* __init__.py in the module_utils directories must be empty, so a
new file myerror.py was added to move the code from __init__.py
* NOTE: network_lsr/nm/__init__.py is not empty
* The documentation block in the module was not properly constructed
or formatted.
* shellcheck issues, including removing unused files
* use `unused` instead of `_` (underscore) for variables that are
unused
add WARNING to module docs - collection users should not use directly
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Also run github actions for pushing to get CI updates for changes to the
main branch and a baseline to compare PRs to.
Signed-off-by: Till Maas <opensource@till.name>
Use the new https://github.com/linux-system-roles/lsr-gh-action-py26
for running unit tests on python 2.6. This uses an EL6 VM so more
closely corresponds to the managed hosts that still use python 2.6.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
set `LSR_ANSIBLE_TEST_DOCKER: "true"` so that we run ansible-test sanity
with docker
This should fix issues we are seeing with tox ansible-test failures
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Switch to molecule v3. This drops support for v2.
This requires tox-lsr 2 or later.
Upgrade to tox-lsr 2.1.2 to pick up fix for collection dependency
on python six.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
ansible 2.7 has been deprecated
https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html
We need to remove ansible 2.7 from molecule testing in order to
* make room for ansible 2.10 testing
* move to molecule v3
ansible 2.8 and later support platform-python on el8 and later
so we don't have to handle that case explicitly by setting
ansible_python_interpreter for centos8 in molecule.yml
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Since we have disabled linting in molecule, use tox for running
ansible-lint.
In addition, fix molecule config to use `false` instead of `False`
since the former is the correct YAML boolean value. This also
will make network consistent with the other roles.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Use the new vault.centos.org repos. Fix the yum repo configs in the
image if necessary to use these new repos.
Use the standard centos images from the centos registry rather than
custom lsr images from dockerhub.
Add support for centos8. Note that using ansible 2.7 on centos8
requires setting /usr/bin/python3 to be the ansible python
interpreter. Later versions of ansible have better auto-detection.
We can get rid of this once we drop support for ansible 2.7
Use tox-lsr 1.0.1 - which means we do not need
molecule_extra_requirements.txt
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Use tox-lsr instead of the scripts in the `.travis/` directory and the
asssociated config files. Yes, `.travis/custom.sh` is still there,
but once you are familiar with the way that tox-lsr works, you can
remove it and use your own custom tox.ini action. The goal of this
commit was to make as few changes as possible, to keep feature parity
with the old `.travis/` script way of running CI. Also note that
linting has moved into tox, so we needed to disable molecule linting.
The new version of ansible-lint adds a lot of checks, so these are
disabled for now, and should be fixed later. Also, shellcheck is
turned off until the network team can address the issues.
The `.travis/custom.sh` script is not run in the CI environment, so
this was changed slightly to remove the check for `$TRAVIS`, and it is
no longer run as a tox testenv in CI.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
adds a github actions tox workflow for CI testing, since
travis is discontinuing support for open source projects
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
To ensure that old/untouched pull requests do not pile up, configure the
probot stale bot to mark pull requests without activity in the last 30
days as stale and close them after 14 more days if there is no further
activity. The pull requests are marked with the stale label.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>