Commit graph

698 commits

Author SHA1 Message Date
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
Wen Liang
c913aa0b93 Support 'route_metric4' for initscripts provider
The user want to change the metric for the default route, add support
for that.

https://bugzilla.redhat.com/show_bug.cgi?id=2134201

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-10-21 15:22:11 +02:00
Wen Liang
5c9456a8a3 bond: attach ports when creating the bonding connection
When ports are not attached, the bonding connection may risk not in fully
connected state, e.g. connecting (getting IP configuration). Therefore,
attach ports for the bonding connection.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-10-18 13:49:37 +02:00
Wen Liang
d311d60b73 bond: test arp_all_targets only when arp_interval is enabled
Kernel allows to set `arp_all_targets` when `arp_interval` is disabled
(disable ARP monitoring). But `arp_all_targets` specifies the quantity
of `arp_ip_targets` that must be reachable in order for the ARP monitor
to consider a slave as being up. It makes more sense to only set the
`arp_all_targets` while enabling the `arp_interval`.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-10-18 13:49:37 +02:00
Wen Liang
90a8ea5051 bond: improve the validation for setting peer_notif_delay
Synchronize with NM, the default value of peer_notif_delay in NM is 0,
which is not considered as enabling the setting or specifying the
delay.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-10-18 13:49:37 +02:00
Wen Liang
cfbd14cd8a Support looking up named route table in routing rule
The user may need to define the named route table in the routing rule
besides the table id, add support for that.

The commit fixes
https://github.com/linux-system-roles/network/issues/506.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-09-30 16:26:48 +02:00
Rich Megginson
f5a01f94bf [citest skip] tox-lsr 2.13.0; check-meta-versions
Update to tox-lsr 2.13.0 - this adds check-meta-versions to py310

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-08-16 07:36:13 -06:00
Wen Liang
6ee08ce9f3 CHANGELOG: update changelog for 1.9.1 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-08-05 10:46:04 -06:00
Wen Liang
3a591aa3d7 network_state: improve state comparison for achieving idempotency
`libnmstate.show()` would include the info like bridge timer etc which
should not be considered when comparing between the previous state and
current state. Instead, using the the `libnmstate.show_running_config()`
which would filter out these kind of data.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-08-05 15:08:53 +02:00
Rich Megginson
26c742d7e3 Use GITHUB_REF_NAME as name of push branch; fix error in branch detection [citest skip]
We need to get the name of the branch to which CHANGELOG.md was pushed.
For now, it looks as though `GITHUB_REF_NAME` is that name.  But don't
trust it - first, check that it is `main` or `master`.  If not, then use
a couple of other methods to determine what is the push branch.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-08-04 11:58:44 -04:00
Thomas Haller
a74092634a argument_validator: fix IPRouteUtils.get_route_tables_mapping() for whitespace sequence
Accept any whitespace sequence, according to Python's `rb"\s"` class.
This way, tabs are also accepted. This is also what iproute2 does.
Use just one regex for this.

Also add a unit test for the default iproute2 file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2022-07-22 10:36:03 -04:00
Wen Liang
200cf67507 CHANGELOG: update changelog for 1.9.0 release
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-07-11 13:13:45 -04:00
Noriko Hosoi
38a84ca16b [citest skip] Add changelog_to_tag.yml to .github/workflows
Description:
When a new changelog section is added to CHANGELOG.md and pushed,
changelog_to_tag.yml is triggered, which generates a new tag and
a new release.

Example of CHANGELOG.md changes:
  [9.9.9] - 2022-12-31
  --------------------

  ### New features

  - New feature A

  ### Bug fixes

  - Bug fix B

Using this example, when the commit on CHANGELOG.md is pushed, a
new tag "9.9.9" is added and Version 9.9.9 is released in github.
If tag "9.9.9" already exists, the CHANGELOG.md push fails.

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
2022-07-10 21:22:20 -04:00
Rich Megginson
58a8e258ef change include to include_tasks
The keyword `include:` is deprecated in favor of
`include_tasks:`.
See https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_module.html

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-07-05 12:52:29 -06:00
Wen Liang
e694ad72c1 Support the nmstate network state configuration
The users want to apply the nmstate network state configuration to the
interface directly through the role, which necessitates the less
complexity of the network configuration and allows the partial
configuration on the network.

To warrant that the users are capable to apply the nmstate network state
configuration, add the support for the `network_state` variable.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-07-01 12:29:38 +02:00
Wen Liang
6dfd6485ed ansible-test: Suppress libnmstate import error in network_state.py
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-07-01 12:29:38 +02:00
Rich Megginson
4d21dcd0ac [citest skip] make min_ansible_version a string in meta/main.yml
The Ansible developers say that `min_ansible_version` in meta/main.yml
must be a `string` value like `"2.9"`, not a `float` value like `2.9`.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2022-06-29 07:07:31 -06:00