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?
Asked
Active
Viewed 240 times
1 Answers
3
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.
SpamapS
- 20,110