Commit graph

714 commits

Author SHA1 Message Date
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
Noriko Hosoi
75f2448ba7 Add check for non-inclusive language
Add a check for usage of terms and language that is considered
non-inclusive. We are using the woke tool for this with a wordlist
that can be found at
https://github.com/linux-system-roles/tox-lsr/blob/main/src/tox_lsr/config_files/woke.yml

Note: this commit uses the customized woke placed locally in
    .github/actions/custom-woke-action to support a new option
    --count-only-error-for-failure option.
    The local action custom-woke-action will be replaced with
    the official woke once https://github.com/get-woke/woke/pull/252
    (Add an option "--count-only-error-for-failure") is processed.

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2023-01-19 15:13:35 -07:00
Noriko Hosoi
f3078c256e Clean up / Workaround non-inclusive words
- CHANGELOG.md
- README.md
- contributing.md
- library/network_connections.py
- module_utils/network_lsr/argument_validator.py
- module_utils/network_lsr/ethtool.py
- tests/ensure_provider_tests.py
- tests/playbooks/tests_bond_options.yml
- tests/unit/test_network_connections.py

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2023-01-19 15:13:35 -07:00
Wen Liang
c526da39c7 Support running the tests with ANSIBLE_GATHERING=explicit
Almost all the network role tests fail with fact gathering disabled.
Therefore, in order to support the tests running with
ANSIBLE_GATHERING=explicit, gather the minimum subset of facts
required.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-01-11 15:24:50 +01:00
Rich Megginson
592fab52a5 add back role-name skip for ansible-lint 5.x
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-01-08 15:12:11 -07:00
Rich Megginson
2d72022cee revert braces and brackets checking
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-01-08 15:12:11 -07:00
Rich Megginson
4dcde83030 disable truthy and document-start for now
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-01-08 15:12:11 -07:00
Rich Megginson
2e8ac7aa66 ansible-lint 6.x updates
The only thing we need to skip currently is using FQCN for ansible
builtin modules, plugins
Add `kinds` - otherwise, Ansible thinks anything not in a traditional
role path is a plain YAML file, and we don't get the additional
checking.
Ensure all plays are named.
Fix some other minor problems.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-01-08 15:12:11 -07:00
Rich Megginson
586b0ec120 Version 1.11.0 - CHANGELOG.md [citest skip]
[1.11.0] - 2022-12-12
--------------------

### New Features

- Support cloned MAC address

### Bug Fixes

- none

### Other Changes

- none

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-12-12 15:46:31 -07:00
Sylvain
79d1fa2739 Support cloned MAC address
The users want to create the bonding interface with the MAC address
specified by themselves or specify the strategy (e.g. random, preserve)
to get the default MAC for the bonding interface. Thus, add support for
the cloned MAC address.

Signed-off-by: Sylvain <35niavlys@gmail.com>
2022-12-12 08:11:23 -07:00
Rich Megginson
385c27420e Use tox-lsr 2.13.1; force the use of tox 3.x [citest skip]
CI is broken pretty hard right now due to tox 4.x being released
It will take non-trivial effort to make tox-lsr work with tox 4.x. So,
in the meantime, tox-lsr 2.13.1 forces the use of tox 3.x

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-12-08 12:09:18 -07:00
Rich Megginson
f2e28ff0a6 python version depends on platform; upgrade checkout, setup-python; support py311 [citest skip]
The python version used now requires a corresponding os version e.g. python 2.7 and
python 3.6 are no longer supported on ubuntu-latest - must use 20.04.  Update
the python matrix to include the os to use as well.

Use checkout@v3 and setup-python@v4

python 3.11 stable is now supported by setup-python

Add `push` action for status reporting on role main page if missing

Use `docker` for ansible-test if not already doing that

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-11-30 10:31:58 -07:00
Rich Megginson
af4c851d5c disable scheduled ci for now 2022-11-18 10:29:05 -07:00
Evgeny Fedin
120018ee52 add weekly-ci action
Signed-off-by: Evgeny Fedin <efedin@redhat.com>
2022-11-17 10:08:57 -07:00
Rich Megginson
0884e24849 Version 1.10.1 - CHANGELOG.md [citest skip]
[1.10.1] - 2022-11-14
--------------------

### New Features

- none

### Bug Fixes

- none

### Other Changes

- support ansible-core-2.14, ansible-lint 6.x

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-11-14 17:33:15 -07:00
Rich Megginson
cf356230ca support ansible-core-2.14, ansible-lint 6.x
ansible-core 2.14 is now the current version of Ansible.  This version
does not support `args: warn: false` so we have to remove it from the
network role.  Users will need to use `COMMAND_WARNINGS` in their
Ansible configuration in order to suppress the warning in older versions
of Ansible such as 2.9, 2.11.
In addition, the gating tests are getting stricter about using new best
practices, such as using `true`, `false` for booleans instead of `yes`,
`no`; use of spaces in Jinja expressions; etc.  These issues were
addressed.
The `tests/` directory contains far too many cases of non-recommended
practices, so this directory has been exempted.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-11-14 13:54:14 -07:00
Rich Megginson
2e43d027f1 Version 1.10.0 - CHANGELOG.md [citest skip]
[1.10.0] - 2022-11-01
--------------------

- Support looking up named route table in routing rule
- Support 'route_metric4' for initscripts provider
- Support the DNS priority

- bond: improve the validation for setting peer_notif_delay
- bond: test arp_all_targets only when arp_interval is enabled
- bond: attach ports when creating the bonding connection

- Set the route metric when testing the 'auto_gateway'
- Fix markdownlint 'unordered list indentation' issue
- add ip.route_metric4: 65535 to failing bond tests
- use rpm -i instead of yum install for epel7

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-11-02 08:20:45 -06:00
Wen Liang
3d10af067a Support the DNS priority
The users want to configure the priority of DNS servers, add support for
that.

Fixes https://github.com/linux-system-roles/network/issues/505.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-11-01 11:55:11 -06:00
Rich Megginson
53208608a4 use rpm -i instead of yum install for epel7
On BaseOS CI systems, `yum install` for the epel7 rpm does not work.
Instead, use `rpm -i` which should work on any system.  We should not
need to use `yum install` here because the epel7 setup rpm does not have
additional dependencies.
In addition, the rpm download sometimes returns 403 - I think it is because
multiple tests run in parallel in BaseOS CI, resulting in too many
download attempts in too short a period of time - so introduce a retry
to mitigate the situation.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-10-31 16:42:04 -06:00
Rich Megginson
036f7c3c1e add ip.route_metric4: 65535 to failing bond tests
When creating a bond, the bond also creates a default route with a
default metric of 0.  This causes test failures on CI systems as
it overrides the system default route.  Use the new `ip.route_metric4`
parameter to set a high metric value so as not to override the
default system route.
Some systems cannot use a metric value of 32 bit unsigned int max value.  To ensure
the broadest possible support, use a metric value of 16 bit signed int max value,
which should be high enough to ensure the routes always have the lowest priority.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-10-28 09:08:12 -06:00
Wen Liang
6a426296d4 Fix markdownlint 'unordered list indentation' issue
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-10-21 15:22:11 +02:00
Wen Liang
78f5e65c4d Set the route metric when testing the 'auto_gateway'
For initscripts provider, the metric for the default route defaults to
0, as a result, the default route can take precedence or blindly ingore
other routes. Adding a higher route metric value to honor other routes
during the route selection.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-10-21 15:22:11 +02:00