`juju switch -` doesn't switch to previous model

Bug #1988426 reported by Jack Shaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
In Progress
Wishlist
Guillaume Fouillet

Bug Description

More of a feature request

Lots of cli tools with a navigation aspect use the dash character to navigate back to the previous place. Such as `cd` and `git checkout`

I think it would be great if `juju switch` could do a similar thing!

setup:
```
$ juju models
Controller: lxd

Model Cloud/Region Type Status Machines Units Access Last connection
controller localhost/localhost lxd available 1 1 admin just now
default* localhost/localhost lxd available 3 3 admin 42 seconds ago

$ juju switch controller
lxd:admin/default -> lxd:admin/controller
```

expected (requested) behaviour
```
$ juju switch -
lxd:admin/controller -> lxd:admin/default
```

actual behaviour
```
juju switch -
ERROR model name "admin/-" not valid
```

Revision history for this message
Vitaly Antonenko (anvial) wrote :

Thx Jack,

Sounds reasonable.

Changed in juju:
status: New → Triaged
importance: Undecided → Medium
importance: Medium → Wishlist
milestone: none → 3.0-rc1
milestone: 3.0-rc1 → 3.0.1
tags: added: swi
tags: added: switch
removed: swi
Changed in juju:
milestone: 3.0.1 → 3.0.2
Changed in juju:
milestone: 3.0.2 → 3.0.3
John A Meinel (jameinel)
Changed in juju:
milestone: 3.0.3 → 3.1-beta1
tags: added: bitesize
Changed in juju:
assignee: nobody → Nicolas Vinuesa (nvinuesa)
Changed in juju:
milestone: 3.1-beta1 → 3.1-rc1
Changed in juju:
milestone: 3.1-rc1 → 3.1-rc2
Revision history for this message
Jordan Barrett (barrettj12) wrote :

https://juju.is/docs/olm/juju-stash is related, originally written by Simon IIRC. I'm not sure if it's been tested recently / works with newer versions of Juju.

Changed in juju:
milestone: 3.1-rc2 → 3.1-rc3
Revision history for this message
Guillaume Fouillet (gfouillet) wrote :

This may be tricky in case of multiple controller, because juju switch can either switch over controller or model, with disambiguation done on the given arg

* juju switch mymodel => switch model
* juju switch mycontroller => switch controller

However, there is already a way of disambiguation through semicolon

* juju switch :- => could switch model
* juju switch -: => could switch controller

Some question may requires decision, like above behavior:

* juju switch - => switch what ? (by default, it is the controller which is prioritized, so `git switch something` will switch to something controller if both something model and controller exists in context)
* juju switch -:mymodel => Is it ok ? What does it do ?
* juju switch mycontroller:- => Is it ok ? What does it do ?

A proper and consistent behavior for this feature would be:

- juju switch :- => switch model
* juju switch -: => switch controller
* juju switch - => By default, switch controller. However, if there is only one controller registered into the client, switch model (this ambiguous command shouldn't be used in CI script, obviously)

Changed in juju:
assignee: Nicolas Vinuesa (nvinuesa) → nobody
assignee: nobody → Guillame Fouillet (gfouillet)
Changed in juju:
milestone: 3.1-rc3 → 4.0-beta4
status: Triaged → In Progress
Revision history for this message
Guillaume Fouillet (gfouillet) wrote :
Jack Shaw (jack-shaw)
Changed in juju:
milestone: 4.0-beta4 → 3.6-beta1
Changed in juju:
milestone: 3.6-beta1 → 3.6-beta2
Revision history for this message
Simon Richardson (simonrichardson) wrote :

This should be in 4.0, I'd like to bake this in before sending it on 3.6. If we do like this, we can always back port it.

Changed in juju:
milestone: 3.6-beta2 → 4.0-beta5
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.