Commit graph

735 commits

Author SHA1 Message Date
Rich Megginson
211412d035 style: ansible-lint - fix missing YAML document start
ansible-lint requires that YAML documents begin with a line
consisting of `---`

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-28 09:15:50 -06:00
Rich Megginson
c0a626ddbb style: Use standard Ansible braces and brackets spacing
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>
2023-04-28 09:13:55 -06:00
Sergei Petrosian
7884537284 ci: Add commitlint GitHub action to ensure conventional commits with feedback
For more information, see Conventional Commits format in Contribute
https://linux-system-roles.github.io/contribute.html#conventional-commits-format

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
2023-04-28 14:36:36 +02:00
Wen Liang
b02e58db76 Fix the failure of running ANSIBLE_GATHERING=explicit on tests_switch_provider.yml
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>
2023-04-27 15:14:49 -06:00
Rich Megginson
ee2a8eb177 docs(changelog): version 1.11.3 [citest skip]
Create changelog update and release for version 1.11.3

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-04-14 09:01:34 -06:00
Wen Liang
46f827419e ansible-lint: Remove the rule 'load-failure' from 'warn_list'
The rule 'load-failure' is unskippable, you cannot use it in
'skip_list' or 'warn_list'.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00
Wen Liang
af76d08550 ansible-lint: Enable the check on 'tests/' directory
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00
Wen Liang
5ff1189409 ansible-lint: Fix name[missing] and name[play] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00
Wen Liang
aa3b6bd8dc ansible-lint: Fix remaining name[casing] warnings
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>
2023-04-05 16:52:39 -06:00
Wen Liang
b1d2f305c2 ansible-lint: Fix remaining jinja[spacing] warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-05 16:44:41 -06:00
Wen Liang
2de826ee24 ansible-lint: Fix yaml[octal-values] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-04 09:52:31 -06:00
Noriko Hosoi
77214cbda4 Fingerprint RHEL System Role managed config files
- Add role name to the generated config files.
  # system_role:network

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2023-03-30 13:38:19 -06:00
Wen Liang
2b693d14c0 ansible-lint: Fix no-changed-when failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-29 13:10:38 +02:00
Rich Megginson
7f26cdb8ac in lsr_assert_when use condition instead of when
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>
2023-03-28 18:26:33 -06:00
Wen Liang
8eed9ae4a9 ansible-lint: Fix ignore-errors failures
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>
2023-03-28 18:41:23 +02:00
Wen Liang
8a3dd3c438 ansible-lint: Fix command-instead-of-module failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-28 18:40:13 +02:00
Noriko Hosoi
b80e178fc5 Add README-ansible.md to refer Ansible intro page on linux-system-roles.github.io
Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2023-03-27 11:04:41 -06:00
Wen Liang
8174d5320d ansible-lint: Fix jinja[spacing] warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-27 16:25:03 +02:00
Wen Liang
cd72556282 ansible-lint: Fix name[casing] warnings
Start all task names an uppercase letter.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-27 16:25:03 +02:00
Wen Liang
a384e5bb00 ansible-lint: Fix key-order[task] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-22 10:21:50 +01:00
Wen Liang
4bac670e65 ansible-lint: Fix name[template] warnings
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>
2023-03-21 17:06:29 +01:00
Wen Liang
e8fef16995 ansible-lint: Fix no-jinja-when, yaml[line-legnth] and package-latest failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-20 14:14:00 +01:00
Wen Liang
3a6f941b2f ansible-lint: Define variable 'network_provider' to fix jinja[invalid] failure
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>
2023-03-20 14:14:00 +01:00
Rich Megginson
c8d3f1dc69 update tox-lsr to 2.13.2; update ansible-lint configuration; start of support for merge queues
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>
2023-03-10 16:58:58 +08:00
Wen Liang
2d0d217070 ansible-lint: Fix schema[playbook] failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-08 16:55:28 +01:00
Wen Liang
65735a85a6 ansible-lint: Fix parser-error failure
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-07 17:17:06 +01:00
Wen Liang
f11e720268 ansible-lint: Fix var-naming warnings
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-03-02 12:08:51 +01:00
dependabot[bot]
47898bab1f Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 17:15:42 +01:00
Wen Liang
c030e50853 Add needed status check on the merge_group
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>
2023-02-27 11:03:22 -07:00
Rich Megginson
bdc896bae6 Version 1.11.2 - CHANGELOG.md [citest skip]
[1.11.2] - 2023-02-20
--------------------

- none

- initscripts: Configure output device in routes

- none

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-02-20 16:58:27 +01:00
Till Maas
3dbe94da5b yamllint: Enable truthy check
Signed-off-by: Till Maas <opensource@till.name>
2023-02-20 15:00:28 +01:00
Wen Liang
101920be5c ansible-lint: Fix yaml[truthy] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-02-20 15:00:28 +01:00
Wen Liang
7c0579ddfc initscripts: Configure output device in routes
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>
2023-02-20 06:36:00 +01:00
Till Maas
e4cc5c138f Unit tests/initscripts: Support checking warnings
Signed-off-by: Till Maas <opensource@till.name>
2023-02-20 06:36:00 +01:00
Till Maas
3ab1a10a03 argument_validator: Use UINT32_MAX constant
Signed-off-by: Till Maas <opensource@till.name>
2023-02-20 04:43:46 +01:00
Till Maas
2fc34dc831 Unify naming of route table name constants
The route tables names are called names, also use "name" in the regex
constant instead of "alias".

Signed-off-by: Till Maas <opensource@till.name>
2023-02-20 04:43:46 +01:00
Till Maas
9919a81f6c Refactor route table ID parsing
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>
2023-02-20 04:43:46 +01:00
Wen Liang
77020c28fa Fix CentOS 7 integration tests
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>
2023-02-13 17:47:55 +01:00
Rich Megginson
0905ccdbf9 Upload coverage files to codecov
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>
2023-02-11 07:36:32 +01:00
Rich Megginson
482560f43a use tox-lsr version 2.13.2
Use tox-lsr version 2.13.2 in order to pick up the codecov
fix.
https://github.com/linux-system-roles/tox-lsr/pull/109

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-02-11 07:35:49 +01:00
Rich Megginson
4039701f30 add back python-26 unit test
The PR https://github.com/linux-system-roles/network/pull/556
erroneously removed the python-26 job for unit testing.  This
PR adds it back.

See also https://github.com/linux-system-roles/.github/pull/10

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-02-10 21:41:35 +01:00
Rich Megginson
39a78d1740 add contents: write permission for branch push
Need `contents: write` permission for branch push for weekly ci job

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-02-09 12:46:34 -07:00
Till Maas
c40ede89f4 mdl_style: Fix rule URLs to use main branch
Signed-off-by: Till Maas <opensource@till.name>
2023-02-09 16:47:25 +01:00
Noriko Hosoi
4ac93457b3 Non-inclusive words - Fix wokeignore comment in README.md
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>
2023-02-09 14:23:43 +01:00
Till Maas
871d715429 Github: Add CODEOWNERS
Signed-off-by: Till Maas <opensource@till.name>
2023-02-09 14:15:58 +01:00
Rich Megginson
9ee0e98b77 Create separate github actions for various checks; get rid of monolithic tox.yml
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>
2023-01-31 08:59:53 -07:00
Rich Megginson
b0e3981b23 address shellcheck issues
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>
2023-01-26 10:34:38 -07:00
Rich Megginson
dc873204b8 Version 1.11.1 - CHANGELOG.md [citest skip]
[1.11.1] - 2023-01-24
--------------------

- none

- none

- ansible-lint 6.x updates
- Support running the tests with ANSIBLE_GATHERING=explicit
- Clean up / Workaround non-inclusive words
- Add check for non-inclusive language
- fix the ansible-pull link, the old do not work
- tag all bond tests with expfail

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-01-24 14:28:27 -07:00
Rich Megginson
a3b7dc4663 tag all bond tests with expfail
The bond tests fail regularly in our single host downstream testing,
so mark them as `expfail` (expect to fail) so that these failures
do not clutter up our test results.

We have tried to fix this in the past - several times over the past
three years, at a cost of many man weeks of effort  - and the fixes just
don't seem to "take".  We have reached the point where we need to cut
our losses and just skip these tests.  Perhaps at some point in the
future we can revisit this issue.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-01-24 12:30:25 -07:00
Bernd Müller
1a5338f452 fix the ansible-pull link, the old do not work
Signed-off-by: Bernd Müller <bernd.mueller@sup-logistik.de>
2023-01-19 15:14:32 -07:00