Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1748283 #8354

Merged
merged 1 commit into from Feb 9, 2018
Merged

Bug 1748283 #8354

merged 1 commit into from Feb 9, 2018

Conversation

hmlanigan
Copy link
Member

Description of change

Complicated YAML needs to be normalized for json/bson before passing via the apiserver. Fix this for cloudinit-userdata.

QA steps

  1. juju bootstrap localhost
  2. setup config.yaml per https://gist.github.com/wwwtyro/6afde641c5c3db038b6b28106345251a (from bug)
  3. juju model-config config.yaml
  4. juju add-machine
  5. juju ssh
  6. cat /usr/share/ca-certificates/cloud-init-ca-certs.crt <- should match data from config.yaml

Documentation changes

N/A

Bug reference

https://bugs.launchpad.net/juju/+bug/1748283

@hmlanigan
Copy link
Member Author

userDataMap := make(map[string]interface{})
if err := yaml.Unmarshal([]byte(raw), &userDataMap); err != nil {
userDataMap, err := ensureStringMaps(raw)
if err != nil {
return errors.Annotate(err, "cloudinit-userdata: must be valid YAML")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that this may be a slightly confusing error message now since YAML does allow non-string keys, but it is probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reworked the error messages a little, so we only get the "must be valid YAML" if the unmarshal fails

or bson, while being sent through the apiserver.
@hmlanigan
Copy link
Member Author

$$merge$$

@jujubot jujubot merged commit 0b408a4 into juju:2.3 Feb 9, 2018
@jameinel jameinel mentioned this pull request Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants