juju / charm-tools

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

add a charm `verify-env` like command #73

Open adam-stokes opened 8 years ago

adam-stokes commented 8 years ago

Since a few environment variables are recommended to be defined during charm-build it may be nice to have something like charm verify-env to check for common settings to be available to help identify potential problems with a user's setup during build.

For example,

$ charm verify-env

Checking env variables

x LAYER_PATH not found
. INTERFACE_PATH found at $HOME/charms/layers
. JUJU_REPOSITORY found at $HOME/charms

Possible fixes for (found bash shell for $USER):

echo "export LAYER_PATH=$HOME/charms/layers" >> ~/.bashrc

Thoughts?

bcsaller commented 8 years ago

Maybe charm build can just include those as INFO level warnings. In truth they are all optional. Mostly we expect things to resolve from interfaces.juju.solutions making LAYER_PATH and INTERFACE_PATH not needed. The -o flag easily replaces JUJU_REPOSITORY if that isn't being used (which implies it might not be part of the developers workflow anyway).

The -l DEBUG flag on charm build does already list these env vars iirc but doesn't include any specific warnings.

The possible fixes idea you have could be included in the output of charm build iif nothing matching an include could be found, and that is a nice addition.

marcoceppi commented 8 years ago

I think having -o default to . is something we may want to reconsider. Where $JUJU_REPOSITORY should be set and is overrideable by -o. A lot of people, myself included, have accidentally built a charm in the layer. This creates a trusty and deps directory and can be a bit distruptive