5

If I have multiple juju environments defined, I will often want to run a series of commands on one of them. Specifying -e on every call is rather tedious, but changing the default every time you switch projects is also annoying. Is there an environment variable I can set in my shell session to specify which environment all subsequent juju commands should be run against?

1 Answer 1

4

There are three ways to manage Juju environments within the command line. One way is to set the "default" YAML key to the environment you want to use by default:

default: devel
environments:
  production:
    ...
  devel:
    ...
  staging:
    ...

You can override the default environments.yaml key by passing an -e flag with each Juju command, the value set to which environment you want to use:

juju bootstrap -e staging
juju deploy -e staging mysql
juju status -e production
juju destroy-environment -e devel

Lastly, Juju will look for the JUJU_ENV environment variable. You can export that then reset it to either an empty string or a new value to avoid changing the default environments.yaml key or using the -e flag

marco@work:~$ export JUJU_ENV=production
marco@work:~$ juju bootstrap
2012-11-14 13:55:44,235 INFO Bootstrapping environment 'production' (origin: ppa type: ec2)...
2012-11-14 13:55:45,567 INFO 'bootstrap' command finished successfully

marco@work:~$ export JUJU_ENV=local
marco@work:~$ juju status
2012-11-14 13:55:39,504 INFO Connecting to environment...
2012-11-14 13:55:40,179 ERROR juju environment not found: is the environment bootstrapped?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .