Replace ``python-apt`` functionality (#341)
* setup: Add missing ``psutil`` dependency
* Add module with subset of ``apt_pkg`` API
The ``python-apt`` package is a wrapper around the ``apt`` C++
library which is tightly connected to the version of the
distribution it is shipped on.
This in turn makes it incredibly hard to distribute as a wheel for
a charm that supports a large span of distro versions.
We do not want to rely on system installed Python packages but
distribute the direct charm dependencies as part of the charms
wheelhouse.
As the span of distributions we need to support with reactive
charms widens we will run into compability problems with the
current model.
For further reference see discussion in LP: #1824112 and
juju-solutions/layer-basic#135
* Make c-h use provided apt_pkg compability shim
* Detect consumer use of upstream ``apt_pkg`` module
When our consumer use the upstream ``apt_pkg`` module in
conjunction with the apt_cache helper function, they may expect us
to call ``apt_pkg.init()`` for them.
Detect this situation, log a warning and make the call to
``apt_pkg.init()`` to avoid the consumer Python interpreter from
crashing with a segmentation fault.
* Improve string handling in ``upstream_version``
* Update ``apt_cache`` function signature
Make it more clear that any arguments will be ignored.
* Use AttributeDict trick for ``_container`` class
* Accept any kw args to apt_cache for compability
Add getter helpers to contrib ovs module (#353)
* Add getter helpers to contrib ovs module
This patch adds in some getters for listing bridges and ports on bridges
on the openvswitch. This complements the add and delete methods and is
(primarily) to allow the neutron-gateway charm to remove bridges/ports
that are no longer in the config for that application.
Related-Bug: lp#1809190
* Update test_ovs.py for PEP8 compliance
* Filter out empty strings if ovs-vsctl returns no lines
If there are no bridges configured, then the command may return no lines
and thus would return an empty string. Thus, filter them out, so that
an empty list is returned instead.