juju needs to fix the yaml parser

Bug #1543660 reported by Matt Bruzek
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Tim Penhey
golang-goyaml (Ubuntu)
New
Undecided
Unassigned

Bug Description

I was at cfgmgmtcamp where a customer (neo4j) found a bug in the juju YAML parser.

They were using a configuration value for a key in their software, the key is numeric and starts with zero.

  install_keys:
    type: string
    description: The key for the Debian package repository.
    default: 01182252

When trying to deploy this value Juju throws an error:

WARNING failed to load charm at "/tmp/trusty/number": invalid config default: option "install_keys" expected string, got 1.182252e+06

When numbers start with 0 YAML interprets that as an octal number, the 8 makes this number an invalid octal number and thus should be handled as a string. Both the python YAML library and on-line YAML validators correctly load 01182252 as a string because it is not a valid integer.

A work around to this is to use quotes all the time, but this is a valid use of YAML that juju should fix.

Changed in juju-core:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Matt Bruzek (mbruzek) wrote :

I created a bug report for the go-yaml implementation that I believe juju uses: https://github.com/go-yaml/yaml/issues/157

Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.1.0
no longer affects: juju-core
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'm also being hit by this, I can't use an aws-account-id with a leading 0 in a deployer file even if I quote it:

2017-01-20 09:34:58 [INFO] deployer.import: Deploying application myapp using /home/andreas/bundles/mybundles/myapp/xenial/myapp
2017-01-20 09:35:33 [ERROR] deployer.env: Error deploying application 'myapp'
2017-01-20 09:35:33 [ERROR] deployer.env: Command (juju deploy -m vmwarestack-maas2:admin/default --config /tmp/tmp2MDO9K --num-units 2 --series xenial /home/andreas/bundles/mybundles/myapp/xenial/myapp myapp) Output:

 Deploying charm "local:xenial/myapp-10".
ERROR option "aws-account-id" expected string, got 20

2017-01-20 09:35:33 [INFO] deployer.cli: Deployment stopped. run time: 50.39

$ grep aws-account-id myapp.yaml
        aws-account-id: "019"

The bundle has that value wrapped in quotes, but those get dropped because 019 is not a valid octal number, so it must be a string and no quotes are necessary:

>>> yaml.dump(yaml.load('{aws_account_id: "019"}\n'))
'{aws_account_id: 019}\n'

tags: added: landscape
Revision history for this message
David Britton (dpb) wrote :
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Linked yaml issues was merged into go-yaml 18 days ago.
Juju needs to update library dependency to a newer revision to take advantage of the merge.

Changed in juju:
importance: High → Medium
tags: added: usability
Revision history for this message
Tim Penhey (thumper) wrote :

https://github.com/go-yaml/yaml/issues/157 has been closed, but the PR mentioned doesn't fix this issue.

Juju is being updated, but until go-yaml fixes it, we still have a problem.

Revision history for this message
Tim Penhey (thumper) wrote :

Having to push this off the 2.1 milestone due to the dependent library not supporting this use case.

Changed in juju:
milestone: 2.1.0 → 2.2.0
Tim Penhey (thumper)
Changed in juju:
assignee: nobody → Tim Penhey (thumper)
status: Triaged → In Progress
milestone: 2.2.0 → 2.1.0
Revision history for this message
Tim Penhey (thumper) wrote :

Pull request up for the upstream project: https://github.com/go-yaml/yaml/pull/241.

Juju patching the upstream for its builds: https://github.com/juju/juju/pull/6983

Tim Penhey (thumper)
Changed in juju:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju:
status: Fix Committed → Fix Released
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.