> On Jul 1, 2016, at 11:15 , Pete Vander Giessen 
> <[email protected]> wrote:
> 
> 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?

We have run into this problem. Our solution was to make the charms work with 
Python3 on trusty and xenial. The yaml issue was solved by creating a script 
that installs python3-yaml and other required packages before calling our 
python install hook. I can provide an example if you want.

—Brad



-- 
Juju mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to