Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a charm where I'd like to be able to call a small Python script in one of the hooks as part of its execution. Where do I put that helper script? Can I put it in the hooks directory and get it included? Then, once it is transfered to the remote machine, where is it located so that I can execute it?

share|improve this question
up vote 3 down vote accepted

The entire directory of the charm (the root being the dir with metadata.yaml) is bundled and unpacked on the service unit including permission bits (ownership is always transferred to root:root). Hooks are always run with the charm root as current working directory, and saved in $CHARM_DIR.

So, you can put the scripts wherever you want. There's no agreement yet on the best practice for this. Some people feel that only hooks should be in the hooks dir, and external scripts should be in a different dir off the root. Others just put everything in hooks.

share|improve this answer
Thanks for the answer, I'm trying it now but it seems my Openstack setup just broke. Hopefully I'll be able to verify here real soon! – Ted Gould Jun 11 '12 at 18:53
Great! Works here. I made a separate helpers directory and executed my script with $CHARM_DIR/helpers/myhelper. Thanks! – Ted Gould Jun 12 '12 at 3:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.