Comment 0 for bug 2039267

Revision history for this message
Jack Shaw (jack-shaw) wrote : Juju refresh --switch does no validation

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, 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 fill fail if you change the name of your local charm. However:
```
$ juju deploy zookeeper --channel 3
$ juju refresh zookeeper --switch landscape-server --channel stable
```
will succeed