Re: Missing yaml import for charmhelpers on Xenial?

2016-07-05 Thread Pete Vander Giessen
Hi Stuart,

Thank you for the detailed reply.

> If you resync charm-helpers with an up to date version you should be
> right. charm-helpers
> bootstraps the dependencies itself (see the ImportError exception
> handlers in charmhelpers/__init__.py).

I had discovered the charm-helpers sync script, but the script in the
mariadb charm was an old one that didn't actually try to update the
__init__.py files. I found the current version of the script in the
charm-helpers source (bzr branch lp:charm-helpers), copied it into the
charm's scripts folder, and now have a working charm :-)

> (this is of course all superseded with charm-tools and reactive
> charms, which handles dependencies better).

+1 for reactive charms. I was trying to get mariadb working in a hurry, but
I'm thinking that it might have been faster to just make it into a reactive
charm ...

Thanks again,
~ PeteVG

On Sat, Jul 2, 2016 at 8:27 AM Stuart Bishop 
wrote:

> On 2 July 2016 at 03:06, Pete Vander Giessen
>  wrote:
> > I wrote:
> >> I think that I figured this one out. charmhelpers does have PyYAML and
> six
> >> as dependencies, but the mariadb charm was deploying its own, probably
> out
> >> of date version of charmhelpers. Telling it to install charmhelpers
> through
> >> the juju tools, rather than stuff them into its own source tree should
> help
> >> a lot ...
> >
> > ... but that was before I did my homework. I understand better now how
> > charmhelpers gets integrated into non layered charms, and I see why it's
> > bypassing its own setup.py file, and making it tricky to install the
> missing
> > stuff, outside of a supplemental bash script. Hmmm ...
>
> If you resync charm-helpers with an up to date version you should be
> right. charm-helpers
> bootstraps the dependencies itself (see the ImportError exception
> handlers in charmhelpers/__init__.py).
>
> This makefile stanza is the 'standard' way of resyncing charmhelpers:
>
> sync:
> @bzr cat \
>
> lp:charm-helpers/tools/charm_helpers_sync/charm_helpers_sync.py \
> > .charm_helpers_sync.py
> @python .charm_helpers_sync.py -c charm-helpers.yaml
>
> And you need a charm-helpers.yaml desribing the bits that need
> embedding in your charm, like the following:
>
> destination: hooks/charmhelpers
> branch: lp:charm-helpers
> include:
> - coordinator
> - core
> - fetch
> - contrib.charmsupport
> - contrib.templating.jinja
> - contrib.network.ufw
> - contrib.benchmark
>
>
> (this is of course all superseded with charm-tools and reactive
> charms, which handles dependencies better).
>
> --
> Stuart Bishop 
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Missing yaml import for charmhelpers on Xenial?

2016-07-02 Thread Stuart Bishop
On 2 July 2016 at 03:06, Pete Vander Giessen
 wrote:
> I wrote:
>> I think that I figured this one out. charmhelpers does have PyYAML and six
>> as dependencies, but the mariadb charm was deploying its own, probably out
>> of date version of charmhelpers. Telling it to install charmhelpers through
>> the juju tools, rather than stuff them into its own source tree should help
>> a lot ...
>
> ... but that was before I did my homework. I understand better now how
> charmhelpers gets integrated into non layered charms, and I see why it's
> bypassing its own setup.py file, and making it tricky to install the missing
> stuff, outside of a supplemental bash script. Hmmm ...

If you resync charm-helpers with an up to date version you should be
right. charm-helpers
bootstraps the dependencies itself (see the ImportError exception
handlers in charmhelpers/__init__.py).

This makefile stanza is the 'standard' way of resyncing charmhelpers:

sync:
@bzr cat \
lp:charm-helpers/tools/charm_helpers_sync/charm_helpers_sync.py \
> .charm_helpers_sync.py
@python .charm_helpers_sync.py -c charm-helpers.yaml

And you need a charm-helpers.yaml desribing the bits that need
embedding in your charm, like the following:

destination: hooks/charmhelpers
branch: lp:charm-helpers
include:
- coordinator
- core
- fetch
- contrib.charmsupport
- contrib.templating.jinja
- contrib.network.ufw
- contrib.benchmark


(this is of course all superseded with charm-tools and reactive
charms, which handles dependencies better).

-- 
Stuart Bishop 

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Missing yaml import for charmhelpers on Xenial?

2016-07-01 Thread Pete Vander Giessen
I wrote:
> I think that I figured this one out. charmhelpers does have PyYAML and
six as dependencies, but the mariadb charm was deploying its own, probably
out of date version of charmhelpers. Telling it to install charmhelpers
through the juju tools, rather than stuff them into its own source tree
should help a lot ...

... but that was before I did my homework. I understand better now how
charmhelpers gets integrated into non layered charms, and I see why it's
bypassing its own setup.py file, and making it tricky to install the
missing stuff, outside of a supplemental bash script. Hmmm ...

~ PeteVG

On Fri, Jul 1, 2016 at 2:29 PM Pete Vander Giessen <
pete.vandergies...@canonical.com> wrote:

> Hi All,
>
> I think that I figured this one out. charmhelpers does have PyYAML and six
> as dependencies, but the mariadb charm was deploying its own, probably out
> of date version of charmhelpers. Telling it to install charmhelpers through
> the juju tools, rather than stuff them into its own source tree should help
> a lot ...
>
> Thanks for the extra eyes on this.
>
> ~ PeteVG
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Missing yaml import for charmhelpers on Xenial?

2016-07-01 Thread Pete Vander Giessen
Hi All,

I think that I figured this one out. charmhelpers does have PyYAML and six
as dependencies, but the mariadb charm was deploying its own, probably out
of date version of charmhelpers. Telling it to install charmhelpers through
the juju tools, rather than stuff them into its own source tree should help
a lot ...

Thanks for the extra eyes on this.

~ PeteVG
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Missing yaml import for charmhelpers on Xenial?

2016-07-01 Thread Pete Vander Giessen
Hi Brad,

> 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.

It's pretty straightforward to call apt install on python-yaml or
python3-yaml, but I please do share the script -- I'd appreciate knowing
what else might be missing :-)

Thank you,
~ PeteVG

On Fri, Jul 1, 2016 at 11:23 AM Brad Crittenden  wrote:

>
> > On Jul 1, 2016, at 11:15 , Pete Vander Giessen <
> pete.vandergies...@canonical.com> 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
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Missing yaml import for charmhelpers on Xenial?

2016-07-01 Thread Brad Crittenden

> On Jul 1, 2016, at 11:15 , Pete Vander Giessen 
>  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
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Missing yaml import for charmhelpers on Xenial?

2016-07-01 Thread Pete Vander Giessen
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
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju