Rather than having to maintain .yamllint.yml with a list of files
exempt from yamllint line-length checking, either fix the code
to abide by the line length restriction, or put the yamllint
exceptions in-line in the code.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Use standard Ansible spacing for braces and brackets. This
allows us to remove those rule exceptions from .yamllint.yml
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
The test `tests_switch_provider.yml` fails to run with
`ANSIBLE_GATHERING=explicit` with the error described below. Therefore,
include the task 'el_repo_setup.yml' before running the test which
supports gathering the minimum subset of facts required.
```
TASK [set fact to use initscripts network_provider]
task path: /tmp/tmp.Q6nP8W4iPS/rhel_system_roles/tests/network/playbooks/tests_switch_provider.yml:8
fatal: [/tmp/tmp.Q6nP8W4iPS/RHEL_8_8_TESTING.qcow2]: FAILED! => {}
MSG:
The conditional check 'ansible_distribution in ['CentOS', 'RedHat'] and
ansible_distribution_major_version in ['7', '8']' failed. The error
was: error while evaluating conditional (ansible_distribution in
['CentOS', 'RedHat'] and ansible_distribution_major_version in
['7', '8']): 'ansible_distribution' is undefined.
```
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
More name[casing] warnings are discovered by ansible-lint,
this may be due to the upgrade of ansible-lint.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
ansible-lint is confused by the use of `when:` with `lsr_assert_when`.
It thinks the `when` string should be evaluated as a Jinja expression
but it is really just a plain string. To make this more friendly to
ansible-lint, use `condition:` instead of `when:` with
`lsr_assert_when`.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
In some test playbooks, the `ignore_errors: true` can not be replaced
by `changed_when: false`, because `changed_when` is not a valid
attribute for a IncludeRole.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Jinja templates should only be at the end of 'name'. This helps with
the identification of tasks inside the source code when they fail.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
ansible-lint 6.x syntax check raises `jinja[invalid]` error on the
mandatory variable 'network provider' because it is not defined. In
order to fix the problem, define the 'network_provider' variable in
the file .ansible-lint. The value of the variable is less important as
long as it is reasonable which only meets the purpose of passing the
ansible-lint 6.x syntax check.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Update tox-lsr to 2.13.2
Update ansible-lint configuration
Add support for merge queues to github actions
This doesn't mean all system roles support merge queues,
this is just a preliminary step
See https://github.com/linux-system-roles/.github/pull/21
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
When adding an approved PR to the merge queue, the required status
checks of the workflows are missing, which prevents the PR getting
merged. This commit is intended to trigger merge group checks with
Github Actions, so that the workflows will report the needed status
checks.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Without an explicit output device, the kernel might use a different
output device than intended by the user. Therefore, use the interface
name of connections to specify it if it is available. Otherwise,
educate the user about this potential problem with a warning. This
aligns the behavior with NetworkManager which configures the output
device in routes when activating profiles on devices.
Fixes: https://bugzilla.redhat.com/2168735
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Simplify the parsing of route table IDs to avoid unnecessary exception
handling that makes the code harder to understand and triggers CodeQL
warnings. Also re-organize the unit tests and add a missing test for
table IDs higher than 0xFFFF_FFFF to achieve full test coverage.
Signed-off-by: Till Maas <opensource@till.name>
The newest ubuntu upgrade (ubuntu-22.04) in the github actions runner
image causes the CentOS 7 integration tests broken, to fix it, specify
the ubuntu-20.04 runner image for the CentOS 7 integration tests.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Add a github action task to upload the coverage files
to codecov after the unit tests are complete.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
To allow a "non-inclusive word" in README.md, a wokeignore rule
was added as follows.
```
<!--- wokeignore:rule=word -->
"non-inclusive word" in kernel and NetworkManager.
```
When the markdown format is converged to the html format,
the comment line is treated as a blank line proceeded by `<p>`.
```
<p><!--- wokeignore:rule=word --><br />
"non-inclusive word" in kernel and NetworkManager.
```
Starting with `<p>` and being followed by`<br />`, the
wokeignore rule loses the ability to make the inclusive language
utility `woke` skip checking the non-inclusive word in the next
line.
Instead of putting the wokeignore rule comment above the non-
inclusive word, it's placed in the same line.
Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
There are now separate github actions for the various tests, instead of all of
them being done as part of the tox tests in tox.yml - ansible-lint,
ansible-test, etc.
Use the officially supported github actions e.g. for ansible-lint, ansible-test,
rather than using our own from `tox-lsr` and trying to keep up with the latest
changes. Developers will still be able to use `tox-lsr` on their local
development environments to run these tests in the same way that they are run in
github actions, so that errors found when submitting PRs can be reproduced and
corrected locally without too many github UI roundtrips.
Using separate github actions, and especially the official github actions which
generally have support for in-line comments, should help greatly with
readability and troubleshooting test results.
Python tests are removed from roles that do not use python.
Python tests are now done by python-unit-tests.yml which also does the black,
flake8, and pylint tests.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
Use `grep -E` instead of deprecated `egrep`
Ignore the "use double quotes" rule because we want the
variables to be expanded with all of the spaces.
Signed-off-by: Rich Megginson <rmeggins@redhat.com>