use of charmhelpers log function raise exception if not under juju environment
| 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
will raise an exception: OSError: [Errno 2] No such file or directory
| affects: | numactl (Ubuntu) → charm-tools |
| Thierry FAUCK (thierry-j) wrote : | #1 |
| Marco Ceppi (marcoceppi) wrote : | #2 |
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 |


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