Right, I will remove the JUJU_REPOSITORY variable entirely then to reduce any implicit needs for a beginner.
@munir12 I’ve taken your advice and if you like to have a look at my new thread here: https://discourse.jujucharms.com/t/charm-problems-with-bash-hooks/1229
when you run
charm create layer-example, it will actually use
layer-example as the final charm name, which is not as expected.
charm build layer-example, you will get:
- a charm named
- In metadata.yaml of the charm, you will see
reactivedir, you wil see file
apt.pyfor layer-apt, which are inconsistent in names.
layer-example.py, you will see flag
layer-example.installedand hook func
def install_layer_example(), while apt layer doesn’t work with names like that.
There are more examples like above, in which the prefix
layer- should not exist. I think the prefix
layer- should only be used for repo name. So a smooth process to create a layered charm will be:
cd ~/charms/layers charm create example # edit files in example/ # create git repo `layer-example` and push charm build example cd ~/charms/builds/example # deploy or push to charm store
You are probably right here. Its probably worth fixing too.
sudo juju deploy ./example
ERROR invalid charm “example”: has no hooks
Any suggestion how to fix it?
Hello and welcome to the community.
To be able to help, could you provide a bit more context?
A separate suggestion is to avoid running juju as the root user. Sudo is a powerful tool, and it can (and will) create problems for you.