config.yaml should have enum type

Bug #918386 reported by Gustavo Niemeyer
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Medium
Unassigned
pyjuju
Triaged
Low
Unassigned

Bug Description

Currently only string is an acceptable type for data in the config.yaml file. Other types should be added, primarily: enum, integer, and boolean to help maintain some sanity in configuration options.

This bug covers enum only. For boolean, see bug #885551.

Changed in juju:
importance: Undecided → Wishlist
Marco Ceppi (marcoceppi)
description: updated
Changed in juju:
status: New → Triaged
Curtis Hovey (sinzui)
Changed in juju:
importance: Wishlist → Low
tags: added: improvement
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

Adding this to juju-core, as enums are still being requested for juju configuration

tags: added: charmers
removed: improvement
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

Conceptually, could look like this:

options:
    tuning:
        default: 'safe'
        type: enum
        description: 'Tuning level for service'
        selection:
            unsafe: 'Fastest without regards to data'
            fast: 'Balanced saftey/speed’
            safe: 'Data Safe'

Selection defines the enumerated keys, each key is set to a human readable description. This would be rendered in the Juju GUI as a dropdown using the values of each selection key as the value which is displayed to the user.

Revision history for this message
Mark Ramm (mark-ramm) wrote :

Given that this is behavior that ought to cross core/gui/jaas/ecosystem it would be good for Rick Harding to weigh in, and ideally we get this prioritized this cycle, with a spec, and cross-team effort to get this done.

Revision history for this message
Richard Harding (rharding) wrote :

This would be part of the config schema work that has been talked about but not planned or prioritized. There's a goal to move all config to the same jsonschema mechanism that actions uses which is why it allows more advanced types to be used.

We need to build the case to work on this over other priorities in the next cycle. Knowing more about the pain points will help us build that case.

Curtis Hovey (sinzui)
Changed in juju-core:
status: New → Triaged
importance: Undecided → High
milestone: none → 1.26-alpha1
tags: added: config
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 1.26-alpha1 → 1.26-alpha2
Changed in juju-core:
milestone: 1.26-alpha2 → 1.26.0
Changed in juju-core:
milestone: 1.26.0 → 2.0-alpha1
Changed in juju-core:
milestone: 2.0-alpha1 → 2.0-alpha2
Changed in juju-core:
milestone: 2.0-alpha2 → 2.0-alpha3
Changed in juju-core:
milestone: 2.0-alpha3 → 2.0-beta4
Changed in juju-core:
milestone: 2.0-beta4 → 2.1.0
affects: juju-core → juju
Changed in juju:
milestone: 2.1.0 → none
milestone: none → 2.1.0
Revision history for this message
Anastasia (anastasia-macmood) wrote :

https://github.com/juju/jsonschema/schema was added 4 months ago and supports enum types.

Marking is as Fix Committed but adding it to current development milestone - 2.1-rc1 as all others are already released and are no longer available.

Changed in juju:
status: Triaged → Fix Committed
milestone: 2.1.0 → 2.1-rc1
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Let me check if it is used everywhere.

Changed in juju:
status: Fix Committed → Triaged
Revision history for this message
Anastasia (anastasia-macmood) wrote :

This is used in interactive bootstrap and as an input to add-cloud.

Changed in juju:
status: Triaged → Fix Committed
assignee: nobody → Nate Finch (natefinch)
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Looked at the bug again :)

We have not moved config.yaml as was intended according to comment #4. We have just introduced added jsonschema library that has enum support for other Juju functionality as described above.

I'll leave this bug as Medium. This work still needs to take place

Changed in juju:
status: Fix Committed → Triaged
importance: High → Medium
assignee: Nate Finch (natefinch) → nobody
milestone: 2.1-rc1 → none
Revision history for this message
Drew Freiberger (afreiberger) wrote :

This bug needs revisiting.

There are many charms that have to manage internal validation of enum-type config.yaml variables that should be handled at the juju client/bundle/validation layer instead of having to re-code enum validation in each charm.

See bug https://bugs.launchpad.net/charm-rabbitmq-server/+bug/1942918 as an example of how operators can easily shoot themselves in the foot without these safety measures.

Having the schema validation for enum-type variables at the client end can prevent config-changed hooks from erroring and causing outage of juju-managed applications.

Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This Medium-priority bug has not been updated in 60 days, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Medium → Low
tags: added: expirebugs-bot
Revision history for this message
Andrea Ieri (aieri) wrote :

I can't update the importance field but from our perspective nothing has changed, this bug should still be marked as medium priority.

Andrea Ieri (aieri)
Changed in juju:
status: Triaged → New
Changed in juju:
status: New → Triaged
importance: Low → Medium
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.