Commit graph

14 commits

Author SHA1 Message Date
Wen Liang
512d840fc4 Util: Normalize address family value before getting prefix length
Some address family values (e.g. "ipv4" or "ipv6") should not be
considered as bogus value if they can be normalized into
`socket.AF_INET` or `socket.AF_INET6`, it is more tolerant but also
still preserving the capability for rejecting the utterly bogus address
family values.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2022-04-21 12:19:26 +02:00
Rich Megginson
16ac152542 support ansible-core 2.12; ansible-plugin-scan; fix pylint errors; py39
Use the new tox-lsr that uses ansible-core 2.12.
Use ansible-plugin-scan in CI.
Fix pylint errors found by new ansible-test pylinter.
CI test with py39

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2021-11-08 20:01:01 +01:00
Rich Megginson
c1b0002bc9 fix python black issues
There was recently an upgrade to python black which made function
documentation checking stricter.  This caused network tox CI to
break.  The fix is to format the function doc text in the manner
expected by black.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2021-05-03 18:41:05 +02:00
Rich Megginson
f5ff30a66c fix most ansible-test issues, suppress the rest
Automation Hub, and possibly Galaxy in the future, require the
collection to be screened with `ansible-test sanity` among other
checks.  The role had a number of issues:
* Use `AssertionError` instead of `assert`
* Use of `logging` module not in accordance with standards, but these
  are ok and the errors were suppressed
* Several import errors which are ok because they are checked
  elsewhere
* __init__.py in the module_utils directories must be empty, so a
  new file myerror.py was added to move the code from __init__.py
  * NOTE: network_lsr/nm/__init__.py is not empty
* The documentation block in the module was not properly constructed
  or formatted.
* shellcheck issues, including removing unused files
* use `unused` instead of `_` (underscore) for variables that are
  unused

add WARNING to module docs - collection users should not use directly

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2021-04-09 19:57:55 +02:00
Noriko Hosoi
890af84071 RHELPLAN-56586 - sync collections related changes from template to network role
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.
2020-10-23 13:35:14 +08:00
Elvira Garcia Ruiz
6eb2d1d938 utils: Fix error message format
Signed-off-by: Elvira Garcia Ruiz <elviragr@riseup.net>
2020-06-25 14:00:23 +02:00
Fernando Fernandez Mancera
2e5dd50852 ethtool: use GPERMADDR instead the ethtool command line tool
This patch implements the ETHTOOL_GPERMADDR command in order to retrieve
the permanent address from ethtool instead using command line tool.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-05-15 16:11:56 +02:00
Fernando Fernandez Mancera
024ba709f6 library: all the imports must be on the top
According to PEP8 [1], the import are always put at the top of the file,
just after any module comments and docstrings, and before module globals
and constants.

[1] https://www.python.org/dev/peps/pep-0008/#imports

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2020-05-14 11:34:27 +02:00
Jack Adolph
4af8f23955 Add support for 802.1x wired connections (EAP-TLS only)
Only EAP-TLS method is supported. Must use NetworkManager as the network_provider.
Also fixed bug in do_connections_validate_nm() function.
2020-03-25 10:49:10 +01:00
Till Maas
c443947150 Utils: Add helper to call sync NM methods 2019-06-14 12:00:15 +02:00
Thomas Haller
c0b2430144 module: minor cleanup of Util.GMainLoop_run()
It was rather confusing whether the boolean return value meant
that the timeout was reached or the opposite.

Rename the internal variable, I think now it's quite clear.
2019-01-10 14:39:15 +01:00
Till Maas
6fc00a0d43 Make connections volatile instead of removing them
This keeps the profile up in Network Manager for
persistent_state:absent.
2019-01-10 14:39:15 +01:00
Thomas Haller
8daa14eb36 module: make Utils.create_uuid() working without pygobject
Utils.create_uuid() only needs the "uuid" module, which
is commonly available. Don't load it together with the
NM module, as that requires pygobject.
2018-10-10 15:20:25 +02:00
Till Maas
382c34197b Modularize role
Splitting the role in smaller parts helps to keep the overview and to
develop separate tests.
2018-08-15 10:04:47 +02:00