From: Pete Vander Giessen Date: Thu, 2 Mar 2017 14:25:10 +0000 (-0500) Subject: Use config-yaml by default when deploying a bundle. X-Git-Tag: 0.4.0~17^2 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=commitdiff_plain;h=ddb6307d17899412f983dab258c3d27089baaf4b Use config-yaml by default when deploying a bundle. This invokes better/more modern behavior for blank strings in the options for a given charm in the bundle.yaml. Specifically, it allows us to deploy landscap-dense-maas without running into a KeyError. This has been tested by using matrix to successfully deploy landscape-dense-maas, using the code in this PR. --- diff --git a/juju/model.py b/juju/model.py index 1177f00..1106a16 100644 --- a/juju/model.py +++ b/juju/model.py @@ -1650,14 +1650,18 @@ class BundleHandler(object): """ # resolve indirect references charm = self.resolve(charm) - # stringify all config values for API + # stringify all config values for API, and convert to YAML options = {k: str(v) for k, v in options.items()} + options = yaml.dump({application: options}, default_flow_style=False) # build param object app = client.ApplicationDeploy( charm_url=charm, series=series, application=application, - config=options, + # Pass options to config-yaml rather than config, as + # config-yaml invokes a newer codepath that better handles + # empty strings in the options values. + config_yaml=options, constraints=parse_constraints(constraints), storage=storage, endpoint_bindings=endpoint_bindings,