Missing yaml import for charmhelpers on Xenial?

Pete Vander Giessen pete.vandergiessen at canonical.com
Fri Jul 1 15:15:20 UTC 2016


Hi All,

I ran into an issue making a version of the mariadb charm for Xenial, and
wanted to know if others had run into it, and whether we had any best
practices or workarounds.

Mariadb is a non layered charm that uses hooks written in Python. Two of
the hooks -- "install' and "config-changed", specifically -- import
charmhelpers. Both of those hooks fail on an import error on Xenial, when
charmhelpers attempts to import yaml.

Pyaml isn't part of the Python standard library, but it looks like it is
installed by default in the default Python distribution on any given series
of Ubuntu. On Xenial, this means that yaml is automatically available to
 Python 3, but not to Python 2, which is what the scripts were using.

The solution is either to a) port the install and config-changed hooks to
python3, which is what I did while rushing to meet a deadline yesterday, or
b) to install yaml in Python 2, which is the simpler solution that seems
obvious this morning, after I am no longer worried about deadlines :-)
 (Note that solution "a" breaks the charm in trusty, as Python 3 is not the
default version of Python for Trusty, and does not have yaml installed by
default in that series.)

I wanted to ping the list to see if anybody had run into similar problems
porting charms to Xenial, however. Should I open a ticket against
charmhelpers to add pyaml as a dependency? Are there other, better
workarounds?

Thank you,
~ PeteVG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20160701/7af271ec/attachment.html>


More information about the Juju mailing list