charmhelpers.contrib.network.ip needs to install python3-netifaces on xenial

Bug #1660630 reported by Tilman Baumann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Undecided
Felipe Reyes

Bug Description

charmhelpers.contrib.network.ip tries to import the netifaces module. If it fails, it installs the package python-netifaces.

But on Xenial, this package is called python3-netifaces. (python-netifaces exists. But it is for the wrong python version)

This is even more perfidious because one can not use the basic-layer apt dependencies to fix this. Because the import happens at load time of the hooks. Before any dependencies can be pulled from any other code.

I suppose a valid workaround is trying to install both versions of the package.
apt_install(['python-netifaces', 'python3-netifaces'], fatal=True)

I'm pretty sure this problem exists for other packages which are pulled in by charmhelpers too.
Just a few lines below is python-netaddr. That one has the same problem for sure.

Cheers
 Tilman Baumann

Related branches

tags: added: chamhelpers juju python3
Revision history for this message
Stuart Bishop (stub) wrote :

Other modules use 'if six.PY2' to detect the Python version and install the correct package.

Felipe Reyes (freyes)
Changed in charm-helpers:
assignee: nobody → Felipe Reyes (freyes)
Stuart Bishop (stub)
Changed in charm-helpers:
status: New → Fix Committed
Revision history for this message
Tilman Baumann (tilmanbaumann) wrote :

Thanks

Changed in charm-helpers:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.