Juju refresh --switch does not validate correctly/consistently

Bug #2039267 reported by Jack Shaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
High
Jack Shaw

Bug Description

Reproduced in 2.9 and 3.3

juju refresh help text states

```
Please note that --switch is dangerous, because juju only has limited
information with which to determine compatibility; the operation will succeed,
regardless of potential havoc, so long as the following conditions hold:

- The new charm must declare all relations that the application is currently
  participating in.
- All config settings shared by the old and new charms must
  have the same types.
```

Juju also sometimes verifies the charm names in metadata match. However, I do not believe this is documented

However, no such validations take place
```
$ juju deploy ch:ubuntu
$ mkdir ubuntu
$ juju download ubuntu --filepath ubuntu/ubu.charm
$ cd ubuntu
$ unzip *
(edit config.yaml such that)
$ cat config.yaml
options:
  hostname:
    type: int
    default: 0
    description: Override hostname of machine, when empty uses default machine hostname

$ cd ..
$ juju refresh ubuntu --switch ./ubuntu
Added local charm "ubuntu", revision 14, to the model
(success!)
```

Note, the above will correctly fail if you change the name of your local ubuntu charm. However:
```
$ juju deploy zookeeper --channel 3
$ juju refresh zookeeper --switch landscape-server --channel stable
```
will incorrectly succeed, according to this (undocumented?) feature

Jack Shaw (jack-shaw)
description: updated
Changed in juju:
assignee: nobody → Jack Shaw (jack-shaw)
Jack Shaw (jack-shaw)
summary: - Juju refresh --switch does no validation
+ Juju refresh --switch does not validate correctly/consistently
Changed in juju:
status: New → Triaged
importance: Undecided → High
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.