Means to reject a config option

Bug #1969521 reported by Leon
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Wishlist
Unassigned

Bug Description

config.yaml is key to the juju model.

Currently, Juju would rightfully reject invalid config options based on the type: string, int, float and boolean (https://juju.is/docs/sdk/config).

However, in some cases, config option validation can only be done in charm code:
- string option is limited to some values;
- a numeric option has a range (e.g. percentage is a float 0-100);
- etc.

Currently, charm code cannot "argue" with a juju config entry: it must act on it regardless if it is deemed valid or not in the context of the charm. Current practice is to set the status to "blocked" and perhaps stop the pebble service, or let the service run (but then it would constitute an unrightful deviation from the juju model).

It would be a smoother charm dev and user experience if config options could be rejected so the only thing charm code would need to do is validate and reject, instead of being forced to accept and act on it.

tags: added: config feature
Changed in juju:
importance: Undecided → Wishlist
milestone: none → 3.0.0
Revision history for this message
Vitaly Antonenko (anvial) wrote (last edit ):

Hi, Leon

Sounds reasonable,

I'll mark it as a feature request, to be able to discuss it in future cycle roadmap cycles.

Thank you.

Changed in juju:
status: New → Triaged
milestone: 3.0.0 → none
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1969521] Re: Means to reject a config option

We should probably add the 'Scriptlets' tag to this, as it would provide a
nice place to do config validation server side, allowing you to give very
fast feedback

On Mon, Jun 6, 2022 at 7:00 AM Vitaly Antonenko <email address hidden>
wrote:

> ** Changed in: juju
> Status: New => Triaged
>
> ** Changed in: juju
> Milestone: 3.0.0 => None
>
> --
> You received this bug notification because you are subscribed to juju.
> Matching subscriptions: juju bugs
> https://bugs.launchpad.net/bugs/1969521
>
> Title:
> Means to reject a config option
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1969521/+subscriptions
>
>

tags: added: scriptlets
Revision history for this message
Robert Carlsen (rwcarlsen) wrote :

This definitely feels like a server/controller level thing. It's tricky because you would need the validation feedback before committing/sending the new changes out. If it wasn't done in the controller, you could imagine units providing different answers, or the leader missing the event to validate it somehow and the config change hanging.

Revision history for this message
Johann David Krister Andersson (jdkandersson) wrote :

Thanks for looking into this, one of the impacts of the scriptlets approach in this case is that the configuration validation code would be somewhat separate from the charm code. If it was a hook on the charm it could be tested along with the rest of the charm code where unit tests would probably do the heavy lifting of the validation.

It would also mean that developers of charms would now also have to learn how to write and test scriptlets which would put another barrier to entry for charm developers.

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.