gui export is exporting invalid config options / not respecting type when serializng

Bug #1200625 reported by Kapil Thangavelu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
juju-gui
Fix Released
High
Kapil Thangavelu

Bug Description

As an example deploy wordpress and then export it, the debug setting will be exported as a boolean, when its schema value is a string.

http://jujucharms.com/charms/precise/wordpress/config

Related branches

Revision history for this message
Benjamin Saller (bcsaller) wrote :

Currently this is just the YAML serialization of the stored value. I'll see how we get a bool from a string and if there is anything simple I can do about it.

Revision history for this message
Benjamin Saller (bcsaller) wrote :

I'm not able to reproduce this locally, the value is 'no' it exports as debug: no which is expected.

envExport:
  series: precise
  services:
    mysql:
      charm: "cs:precise/mysql-25"
      options:
        "binlog-format": MIXED
        "dataset-size": "80%"
        flavor: distro
        "max-connections": "-1"
        "preferred-storage-engine": InnoDB
        "query-cache-size": "-1"
        "query-cache-type": OFF
        "tuning-level": safest
      num_units: 1
      annotations:
        "gui-x": 340
        "gui-y": -83
    wordpress:
      charm: "cs:precise/wordpress-15"
      options:
        debug: yes
        engine: nginx
        tuning: single
        "wp-content": ""
      num_units: 1
      annotations:
        "gui-x": -23
        "gui-y": -75
  relations:
    - - "wordpress:db"
      - "mysql:db"

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Those values need to be quoted properly. Ie the default config value debug is the string 'no', this is getting round tripped to the boolean 'no'. ie if i take the config snippet for the wordpress charm and deserialize i get a string value, not a boolean

import yaml
import pprint

d = yaml.load("""\
debug:
  type: string
  default: "no"
  description: hello world
""")

pprint.pprint(d)

# Example run
# $ python e.py
# {'debug': {'default': 'no', 'description': 'hello world', 'type': 'string'}}

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

juju-core also correctly exports the correct value so this sounds like it might be an issue in the js yaml lib being used or the in mem env.

juju get wordpress
charm: wordpress
service: wordpress
settings:
  debug:
    default: true
    description: 'Setting this option to "yes" will expose /_debug on all instances
      over HTTP. In the _debug folder are two scripts, info.php and apc.php. info.php
      will display the phpinfo information for that server while the apc.php will
      provide APC cache stats (as well as additional administrative options for APC).

'
    type: string
    value: "no"

Revision history for this message
Antonio Rosales (arosales) wrote :

I also ran into this when trying to deploy a wordpress/mysql Juju environment. As Kapil mentions above the deployer tells me that the debug value is incorrect it was expecting a string.

---
2013-07-23 01:25:28 Error deploying service 'wordpress'
2013-07-23 01:25:28 Command (juju deploy -e hp-go --config /tmp/tmpqMmYWg cs:precise/wordpress-15 wordpress) Output:
error: option "debug" expected string, got false
---
2013-07-23 01:30:16 Error deploying service 'mysql'
2013-07-23 01:30:16 Command (juju deploy -e hp-go --config /tmp/tmpL4KqGJ cs:precise/mysql-25 mysql) Output:
 error: option "query-cache-type" expected string, got false
---

Adding a quote around these yaml keywords resolves the issue. Also as Kapil mentions the harms do look to include quotes.

-Thanks,
Antonio

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

I filed the following bug with the upstream yaml lib.. https://github.com/nodeca/js-yaml/issues/85
Its an issue with their dump implementation.

Changed in juju-gui:
assignee: nobody → Kapil Thangavelu (hazmat)
status: New → In Progress
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

submitted a merge proposal upstream, rebuilt the include dep with the change, seems to work well. trying to fight paste .lbox.check at the moment to get a merge proposal to gui.

Gary Poster (gary)
Changed in juju-gui:
importance: Undecided → High
Changed in juju-gui:
milestone: none → 1366900230
Changed in juju-gui:
status: In Progress → Fix Committed
Changed in juju-gui:
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.