deploying a bundle with juju command fails when "1.0" is specified for an option which requires float.
How to reproduce:
$ juju version
2.0-beta15-xenial-amd64
$ cat minimal-bundle.yaml
series: xenial
services:
nova-cloud-controller:
charm: cs:xenial/nova-cloud-controller
num_units: 1
options:
worker-multiplier: 1.0
$ juju --debug deploy minimal-bundle.yaml
...
2016-08-16 18:25:43 INFO juju.api apiclient.go:537 dialing "wss://10.0.8.102:17070/model/aebacf81-78de-4fc1-8025-4a4c14d5e897/api"
2016-08-16 18:25:43 INFO juju.api apiclient.go:313 connection established to "wss://10.0.8.102:17070/model/aebacf81-78de-4fc1-8025-4a4c14d5e897/api"
2016-08-16 18:25:43 DEBUG juju.juju api.go:248 API hostnames unchanged - not resolving
2016-08-16 18:25:43 DEBUG httpbakery client.go:244 client do GET https://api.jujucharms.com/charmstore/v5/xenial/nova-cloud-controller/meta/any?include=id&include=supported-series&include=published {
2016-08-16 18:25:44 DEBUG httpbakery client.go:246 } -> error <nil>
2016-08-16 18:25:44 INFO cmd cmd.go:129 added charm cs:xenial/nova-cloud-controller-4
2016-08-16 18:25:44 INFO juju.juju api.go:74 connecting to API addresses: [10.0.8.102:17070]
2016-08-16 18:25:44 INFO juju.api apiclient.go:537 dialing "wss://10.0.8.102:17070/model/aebacf81-78de-4fc1-8025-4a4c14d5e897/api"
2016-08-16 18:25:44 INFO juju.api apiclient.go:313 connection established to "wss://10.0.8.102:17070/model/aebacf81-78de-4fc1-8025-4a4c14d5e897/api"
2016-08-16 18:25:44 DEBUG juju.juju api.go:248 API hostnames unchanged - not resolving
2016-08-16 18:25:44 DEBUG juju.api apiclient.go:588 health ping failed: connection is shut down
2016-08-16 18:25:44 DEBUG juju.api apiclient.go:588 health ping failed: connection is shut down
2016-08-16 18:25:44 DEBUG juju.api apiclient.go:588 health ping failed: connection is shut down
2016-08-16 18:25:44 ERROR cmd supercommand.go:458 cannot deploy bundle: cannot deploy application "nova-cloud-controller": option "worker-multiplier" expected float, got 1
2016-08-16 18:25:44 DEBUG cmd supercommand.go:459 (error details: [{github.com/juju/juju/cmd/juju/application/deploy.go:429: } {github.com/juju/juju/cmd/juju/application/bundle.go:192: cannot deploy bundle} {github.com/juju/juju/cmd/juju/application/bundle.go:416: cannot deploy application "nova-cloud-controller"} {option "worker-multiplier" expected float, got 1}])
I've run into this in a few situations. juju action.yaml also has the same issue. I have a variable that is type: number (actions.yaml equivalent to float) that doesn't accept a default value of X.0. I feel like this is a yaml pre-processing issue within juju that is truncating the floating point .0 from the values in the parsed yaml before it makes it to the schema gate checks.
I wonder if having a check that a number is an int is valid for a float value as well in the gate check, as I wouldn't expect many applications to require a decimal place (such as 1.0) in their config and not honor a floatkey = <some_int>.
If this is an issue, perhaps we should be handling float in a more string-like fashion with schema checks ensuring that the values are equivalent when typing the string as a float.