Python's Six dependency

Bug #1397134 reported by Sebastian Ferrari
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Critical
Stuart Bishop

Bug Description

unit-drupal-0: 2014-11-27 22:54:51 INFO juju.worker runner.go:260 start "rsyslog"
unit-drupal-0: 2014-11-27 22:54:51 DEBUG juju.worker.rsyslog worker.go:75 starting rsyslog worker mode 1 for "unit-drupal-0" "vagrant-local"
unit-drupal-0: 2014-11-27 22:54:51 DEBUG juju.worker.logger logger.go:45 reconfiguring logging from "<root>=DEBUG" to "<root>=WARNING;unit=DEBUG"

unit-drupal-0: 2014-11-27 22:54:52 INFO install Traceback (most recent call last):
unit-drupal-0: 2014-11-27 22:54:52 INFO install File "/var/lib/juju/agents/unit-drupal-0/charm/hooks/install", line 5, in <module>
unit-drupal-0: 2014-11-27 22:54:52 INFO install import charmhelpers.contrib.ansible
unit-drupal-0: 2014-11-27 22:54:52 INFO install File "/var/lib/juju/agents/unit-drupal-0/charm/hooks/charmhelpers/contrib/ansible/__init__.py", line 66, in <module>
unit-drupal-0: 2014-11-27 22:54:52 INFO install import charmhelpers.contrib.templating.contexts
unit-drupal-0: 2014-11-27 22:54:52 INFO install File "/var/lib/juju/agents/unit-drupal-0/charm/hooks/charmhelpers/contrib/templating/contexts.py", line 9, in <module>
unit-drupal-0: 2014-11-27 22:54:52 INFO install import six
unit-drupal-0: 2014-11-27 22:54:52 INFO install ImportError: No module named six
unit-drupal-0: 2014-11-27 22:54:52 ERROR juju.worker.uniter uniter.go:486 hook failed: exit status 1

I'm getting this with the last charm-helpers version in my charm, so I have to install six manually now.
Where should it be this new dependency?

Oh! my charm is in precise, only (for now).

Related branches

Revision history for this message
Stuart Bishop (stub) wrote :

On trunk, charmhelpers/__init__.py detects that six is not installed and installs the python-six package with apt.

If your charmhelpers/__init__.py is empty, you managed to sync trunk when it was broken. Updating charm-helpers should fix your problem.

If the import code is in charmhelpers/__init__.py, then we need to understand why it is not being invoked as it was when we tested it.

Changed in charm-helpers:
status: New → Incomplete
Larry Michel (lmic)
tags: added: oil
Revision history for this message
Larry Michel (lmic) wrote :

We have recently been seeing this failure quite a bit for precise.

Seeing it for mysql and ceph charms primarily. Here's an excerpt from the unit-mysql-0.log of a failed build.

014-11-30 20:43:20 DEBUG juju.worker.uniter.charm manifest_deployer.go:126 preparing to deploy charm "local:precise/mysql-326"
2014-11-30 20:43:21 DEBUG juju.worker.uniter.charm manifest_deployer.go:102 deploying charm "local:precise/mysql-326"
2014-11-30 20:43:21 DEBUG juju.worker.uniter.charm manifest_deployer.go:147 finishing deploy of charm "local:precise/mysql-326"
2014-11-30 20:43:21 INFO juju.worker.uniter uniter.go:307 charm "local:precise/mysql-326" is deployed
2014-11-30 20:43:21 DEBUG juju.worker.uniter modes.go:398 ModeInstalling local:precise/mysql-326 exiting
2014-11-30 20:43:21 INFO juju.worker.uniter modes.go:396 ModeContinue starting
2014-11-30 20:43:21 INFO juju.worker.uniter modes.go:65 found queued "install" hook
2014-11-30 20:43:21 INFO juju.worker.uniter uniter.go:480 running "install" hook
2014-11-30 20:43:21 INFO install Traceback (most recent call last):
2014-11-30 20:43:21 INFO install File "/var/lib/juju/agents/unit-mysql-0/charm/hooks/install", line 6, in <module>
2014-11-30 20:43:21 INFO install import lib.utils as utils
2014-11-30 20:43:21 INFO install File "/var/lib/juju/agents/unit-mysql-0/charm/hooks/lib/utils.py", line 17, in <module>
2014-11-30 20:43:21 INFO install from charmhelpers.core.host import (
2014-11-30 20:43:21 INFO install File "/var/lib/juju/agents/unit-mysql-0/charm/hooks/charmhelpers/core/host.py", line 19, in <module>
2014-11-30 20:43:21 INFO install import six
2014-11-30 20:43:21 INFO install ImportError: No module named six
2014-11-30 20:43:21 ERROR juju.worker.uniter uniter.go:486 hook failed: exit status 1
2014-11-30 20:43:21 DEBUG juju.worker.uniter modes.go:398 ModeContinue exiting
2014-11-30 20:43:21 INFO juju.worker.uniter modes.go:396 ModeContinue starting
2014-11-30 20:43:21 INFO juju.worker.uniter modes.go:78 awaiting error resolution for "install" hook
2014-11-30 20:43:21 DEBUG juju.worker.uniter modes.go:398 ModeContinue exiting
2014-11-30 20:43:21 INFO juju.worker.uniter modes.go:396 ModeHookError starting

Revision history for this message
Stuart Bishop (stub) wrote :

This all may be fixed on trunk. Per comment #2, I need to now if your version of charmhelpers/__init__.py is empty or not.

Revision history for this message
Ryan Beisner (1chb1n) wrote :
Stuart Bishop (stub)
Changed in charm-helpers:
status: Incomplete → Triaged
Revision history for this message
Stuart Bishop (stub) wrote :

Bug #1398023 seems to have identified the problem, in a round about fashion.

charm-helpers-sync.py does not pull in charmhelpers/__init__.py unless you specifically ask for it. The work around for now is to add '__init__' to your charm-helpersyaml and resync:

branch: lp:charm-helpers
destination: hooks/charmhelpers
include:
    - __init__
    - core
    - fetch
    - contrib.network.ip

I doubt any existing charms would specify __init__.py, as it previously was empty. Many charms will not pick up the omission, as six is likely installed as a dependency already in their test environment. This will cause charms to fail when deployed to cleaner environments where six is not pulled in as a dependency.

The least annoying fix I can come up with is for charm-helpers-sync to implicitly sync charmhelpers/__init__.py. This way, charms will always get the bootstrap code and will find six and yaml available when it is needed (and I imagine this list of packages will expand over time)

Stuart Bishop (stub)
Changed in charm-helpers:
status: Triaged → In Progress
importance: Undecided → High
assignee: nobody → Stuart Bishop (stub)
tags: added: cts
Changed in charm-helpers:
importance: High → Critical
Changed in charm-helpers:
status: In Progress → Fix Released
Revision history for this message
Sebastian Ferrari (sebas5384) wrote :

Thanks for the fix!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers