use of charmhelpers log function raise exception if not under juju environment

Bug #1425938 reported by Thierry FAUCK
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juju Charm Tools
Won't Fix
Undecided
Unassigned

Bug Description

When creating a python script with charmhelpers, the problem is that log() function calls a juju-log() function which is only integrated in juju.
As such trying to execute
                                 python -v hooks/install
will raise an exception: OSError: [Errno 2] No such file or directory

affects: numactl (Ubuntu) → charm-tools
Revision history for this message
Thierry FAUCK (thierry-j) wrote :

For people willing to use charmhelpers out of juju, bypass is to use a script called juju-log located in the default search path.

Revision history for this message
Marco Ceppi (marcoceppi) wrote :

This doesn't seem like a charm-tools issue as much as an issue with the setup. You shouldn't be invoking hooks outside of a hook context. This is really a limitation in Juju not so much charm-tools. You /can/ execute hooks on remote systems using `juju run` and `juju-run`

juju help run

There is also a `juju-run` installed on deployed machines that let you execute code in a hook environment. If you're trying to do testing you'll want to mock these interfaces instead.

Changed in charm-tools:
status: New → Won't Fix
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.