When deactivating a profile in libNM, we should:
* Check `NM.ActionConnection` existence
* Check `NM.ActionConnection.props.state` not DEACTIVATED
* Use signal `state-changed` of `NM.ActionConnection`.
* Only invoke `NM.Client.deactivate_connection_async()` if not
in DEACTIVATING state.
* Ignore `NM.ManagerError.CONNECTIONNOTACTIVE` error.
This patch also introduced a new class `NetworkManagerProvider`
in `module_utils/network_lsr/nm`:
* Independent from Ansible but need to use absolute import due to
limitation of ansible 2.8.
* Provide sync function wrapping async calls of libNM.
* Use stable logging method of python.
* Only load this module when provider is nm.
This patch also changed how logging is handling in
`Cmd_nm.run_action_down()` as initial step on isolate ansible log
mechanism from provider module.
By moving provider codes to `module_utils` folder, we can eventually
simplify the bloated `library/network_connections.py`.
Signed-off-by: Gris Ge <fge@redhat.com>
All links containing references to the "master" branch must be replaced
by the "main" branch.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Source commit in the template repo: e9f2c3a 4f3c96a
Merge pull request #48 from nhosoi/collections
runcollection.sh - stop passing an argument list
This change allows to eliminate the test argument list as well as the
branch name to retrieve the lsr_role2collection.py script for the
collection test.
Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
lock the ansible-lint version to use the latest version 4.3.5 which
is compatible with the latest ansible 2.10
This means we need to suppress the error about the role name
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>
The task 56586 is for adding tests against the collection converted
format to the tox/travis CI to capture a problem before merging the
pr, if any. It'd be helpful to find out bugs in the conversion tool
lsr_role2collection.py, as well. The source of this commit is located
in linux-system-roles/template. They are synced by auto-maintenance/
sync-template.sh, then manually adjusted to the network role.
.travis/runcollection.sh is the test script. tox.ini is modified to run
it in the tox/travis CI. The script downloads lsr_role2collection.py,
then converts the network role into the conversion format in the working
directory .tox. In the collection, it runs a set of tests black, flake8,
yamllint, py38 to check the converted result.
Document how to run integration test with podman, and list the files that are currently not working with podman.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
The main playbook executes integration/test_ethernet.py with pytest, adapting the
installation for different distributions.
Signed-off-by: Elvira García Ruiz <elviragr@riseup.net>
tests/integration/test_ethernet.py is a script capable of using the network
module without executing it from Ansible and using Pytest. The example test
sets an ip in a test interface. The changes in tox.ini adapt the testing to the
new script. The __init__.py files were added to allow python2.7 compatibility.
Signed-off-by: Elvira García Ruiz <elviragr@riseup.net>
To allow running the tests on any arch, do not check for the RPM
architecture when checking the NetworkManager version.
Signed-off-by: Till Maas <opensource@till.name>
* add a helper to create two veth devices with IPv4/IPv6 infra
* add a bond in active-backup mode with miimon value
* add two slaves connections for two veth devices
* check automated IPv4/IPv6 addresses are assigned to master
* check all connections are present
* add a helper to delete previously created veth device setup
This fixes the following traceback:
Traceback (most recent call last):
[...]
File "/home/travis/build/linux-system-roles/network/.tox/env-3.6/lib/python3.6/site-packages/ansiblelint/utils.py", line 775, in expand_path_vars
path = path.strip()
AttributeError: 'PosixPath' object has no attribute 'strip'
Reference: https://travis-ci.com/github/linux-system-roles/network/jobs/373270149
Travis CI is using a version of Docker server that supports API version
1.38. However, the Python PYPI package `docker` version 4.3 was
recently released which uses Docker server API version 1.39, and there
is apparently no way to tell molecule to configure the `docker` Python
API to use a different API. The solution is to install the latest 4.2.x
version of the `docker` Python PYPI package.
Since the order of the actions list does not matter anymore because the
role iterates over all actions in a defined order, simplify the
handling for persistent states.
When a profile is specified as absent, ignore state requests if the
profile is already removed or not completely specified to improve
idempotence.
Also restructure the states test. This introduces a clear structure for
the individual test steps, properly assigns tags for each test from the
file and provides a clear error message with a description of the test
that failed in case of errors. Support for tests that expect a failure
is still missing.
To allow selecting tests with tags, tasks essential tasks need to be
tagged as always to ensure that they are not accidentally skipped when
specifying a tag for a test.
Since `invocation` is an Ansible special value that is set for
triple verbosity, it is now visible for smaller verbosity. Therefore
rename it to `_invocation`, which seems to work with less verbosity.
Also adjust the content to match the regular `invocation` style.
When persistent_state is present and state is set to present or absent, a
ValidationError raises. A unit test validating this has been added. The
test_802_1x.yml test was updated so as to follow this rule.
Signed-off-by: Elvira Garcia Ruiz <elviragr@riseup.net>
To reduce problems with profile specification order and to support
creating and activating bond profiles in one run with initscripts,
create all profiles first.
WPA-PSK and WPA-EAP are supported. Uses existing 802.1x features of the role.
Added extra functionality to ArgValidatorStr to enforce a min and max length.
Ethtool features should use underscores instead of dashes. A
warning shows in case dashes used, and it fails if underscore and dashes are
mixed. Unit tests and integration tests have been added. Since nm already
needed underscores, the string processing that was made in nm_provider is now
unneeded and therefore removed.
Now the contribution document has some steps to facilitate to get into the
project's workflow for new contributors. It also contains the code
structure and how to use the CI testing of the project and basic info about git
configuration. A small reference to the contributing document has been added to
the readme.
Signed-off-by: Elvira Garcia Ruiz <elviragr@riseup.net>