network/module_utils
Gris Ge c4643e56bb nm provider: Refactor the down action of network connection
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>
2020-11-19 18:58:26 +08:00
..
network_lsr nm provider: Refactor the down action of network connection 2020-11-19 18:58:26 +08:00
__init__.py Add Pytest integration tests 2020-08-24 21:52:25 +02:00