weixin_39725594 2020-11-29 16:52
浏览 0

Fixes critical lp#1786140: Current controller should be determined correctly.

Description of change

Previous behavior of environment variables had produces surprising for user results.

Juju used $JUJU_CONTROLLER environment variable for controller level commands and not take $JUJU_MODEL value into consideration, even if the controller was supplied there in the form of <controller name>:<model name>.

At the same time, model level commands completely ignored $JUJU_CONTROLLER environment variable even if it was set.

This changes this behavior - current controller, whenever needed i.e. irrespective of the command level, is determined by looking at $JUJU_MODEL env var first, then $JUJU_CONTROLLER and lastly by the last outcome of running 'juju switch'.

The implicit fix here is also that if env var points to the controller that this client is not aware of (for example, 'juju controllers --refresh' needs to be run) Juju will now fail earlier.

In a follow-up PR, I'll be checking whether we always use $JUJU_MODEL correctly to determine current model. The logic will be similar.

QA steps

  1. bootstrap several controllers
  2. run 'juju switch' to switch to one of them
  3. set $JUJU_CONTROLLER to point to a different controller
  4. all subesquent commands should be running against the controller set by env var

Repeat the same by specifying different controller in $JUJU_MODEL via : format. All coomands should run against the controller specified in $JUJU_MODEL.

Bug reference

https://bugs.launchpad.net/juju/+bug/1786140 https://bugs.launchpad.net/juju/+bug/1813079

该提问来源于开源项目:juju/juju

  • 写回答

6条回答 默认 最新

  • weixin_39725594 2020-11-29 16:52
    关注
    评论

报告相同问题?