Charm Proof: Ensure the default configs match the defined type

Bug #1200713 reported by Antonio Rosales
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juju Charm Tools
Fix Released
Medium
Marco Ceppi

Bug Description

The GUI team suggested Charm Proof check the config.yaml defaults match the defined type.

Tags: charmbrowser
Revision history for this message
Gary Poster (gary) wrote :

Kapil gave the example of bool. The GUI is actually doing it wrong, AFAICT, actually. Here's an except from our config.yaml:

  staging:
    description: |
      Connect the Juju GUI to the staging backend (i.e. a simulated Juju
      environment). Currently juju-core does not support the staging
      backend. For this reason, this option is ignored if the charm is
      deployed using juju-core.
    type: boolean
    default: false

The given default is actually a string, "false," and not the boolean value false. YAML specifies a typecast (http://www.yaml.org/spec/1.2/spec.html#id2803629):

  staging:
    description: |
      Connect the Juju GUI to the staging backend (i.e. a simulated Juju
      environment). Currently juju-core does not support the staging
      backend. For this reason, this option is ignored if the charm is
      deployed using juju-core.
    type: boolean
    default: !!bool false

Revision history for this message
Brad Crittenden (bac) wrote :

The larger point being, 'proof' should check to ensure the default value for an entity is of the correct type. If it is not, and is not coercible, then deploying with the default config may error. E.g.,

type: int
default: cow

should cause proof to flag an error.

Marco Ceppi (marcoceppi)
Changed in charm-tools:
status: New → Triaged
importance: Undecided → Medium
milestone: none → 1.0
Curtis Hovey (sinzui)
tags: added: charmbrowser
Marco Ceppi (marcoceppi)
Changed in charm-tools:
milestone: 1.0 → 1.1
Marco Ceppi (marcoceppi)
Changed in charm-tools:
status: Triaged → In Progress
assignee: nobody → Marco Ceppi (marcoceppi)
Marco Ceppi (marcoceppi)
Changed in charm-tools:
milestone: 1.1.0 → 1.2.0
Marco Ceppi (marcoceppi)
Changed in charm-tools:
milestone: 1.2.0 → 1.3.0
Marco Ceppi (marcoceppi)
Changed in charm-tools:
status: In Progress → 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.