juju / charm-tools

Tools for charm authors and maintainers
Other
42 stars 64 forks source link

charm-build incorrectly picks up layers from $JUJU_REPOSITORY #352

Open johnsca opened 7 years ago

johnsca commented 7 years ago

If a directory with the same name as a base or interface layer exists under the $JUJU_REPOSITORY path, it will be picked up, even when $LAYER_PATH or $INTERFACE_PATH is set and even if there is a matching layer under those paths. We probably shouldn't search $JUJU_REPOSITORY at all for layers, and if $LAYER_PATH or $INTERFACE_PATH are not set, we should default to never using local layers.

[johnsca@murdoch:~ … layers/prometheus] $ charm build
build: Destination charm directory: /home/johnsca/juju/envs/dev/builds/prometheus
build: Processing layer: layer:basic (from ../basic)
build: Processing layer: layer:snap (from ../layer-snap)
build: Processing layer: prometheus (from .)
build: Processing interface: http (from ../../interfaces/http)
build: Processing interface: http (from ../../interfaces/http)                                                                                                             build: Processing interface: http (from ../../interfaces/http)
build: Processing interface: http (from ../../interfaces/http)                                                                                                             build: Processing interface: http (from ../../interfaces/http)
build: Processing interface: nrpe-external-master                                                                                                                          build: Processing interface: grafana-source
build: Processing interface: prometheus
proof: OK!
[johnsca@murdoch:~ … layers/prometheus] $ mkdir $JUJU_REPOSITORY/{http,snap}
[johnsca@murdoch:~ … layers/prometheus] $ charm build
build: Destination charm directory: /home/johnsca/juju/envs/dev/builds/prometheus
build: Processing layer: layer:basic (from ../basic)
build: Processing layer: layer:snap (from ../../snap)
build: Processing layer: prometheus (from .)
build: Processing interface: http (from ../../http)
build: Processing interface: http (from ../../http)
build: Processing interface: http (from ../../http)
build: Processing interface: http (from ../../http)
build: Processing interface: http (from ../../http)
build: Processing interface: nrpe-external-master
build: Processing interface: grafana-source
build: Processing interface: prometheus
charmtools.build.tactics: Missing implementation for interface role: provides.py
johnsca commented 7 years ago

@mitechie

johnsca commented 7 years ago

There are some improvements we could make to the above output, as well. The interface error should indicate which relation endpoint and / or interface name it failed on. The "Processing interface" lines should indicate which relation endpoint / endpoint type they are for, so it's clear why they're being repeated. It would also be helpful for bug reporting, at least, to also report the source directory for the build.