Running juju action with specific values gives ERROR

Bug #1880846 reported by Erik Lönroth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned

Bug Description

I have a juju action which a paramter of "string" type. This is all defined in metadata.yaml.

I expect the string to be either "on" or "off".

When trying to run the action, this happens:

$ juju run-action nextcloud/0 maintenance mod=“on” --wait
ERROR validation failed: (root).mod : must be of type string, given true

I expect alot better information that my arguments have illegal values or even better, allowing for string paramaters to be of any value.

There is a discussion on discourse that describes this situation even more: https://discourse.juju.is/t/debugging-actions-any-documentation/3110/3

Revision history for this message
Erik Lönroth (sssler-scania) wrote :

Also, changing the value to, lets say "foobar" removes the error, but I would like the value to be "on".

Revision history for this message
Erik Lönroth (erik-lonroth) wrote :
Revision history for this message
Yang Kelvin Liu (kelvin.liu) wrote :

Hi Erik,

You can use `--string-args` to tell Juju the arg should be a string rather than boolean:

juju run-action nextcloud/0 maintenance mod=on --wait --string-args

Changed in juju:
assignee: nobody → Yang Kelvin Liu (kelvin.liu)
status: New → Triaged
status: Triaged → In Progress
Revision history for this message
Erik Lönroth (sssler-scania) wrote :

Thats a good workaround I guess, but it really makes no sense and is really not intuitive or consistent to why that would be needed since the paramter type is already defined in the action definition.

Pen Gale (pengale)
tags: added: config
Revision history for this message
Pen Gale (pengale) wrote :

I agree that the error message needs to be more verbose here, but in this case, I think that the yaml parser is doing the right thing. You have a value with two possible states, which is well handled by a boolean. The yaml spec allows you to ask for that boolean with "on" and "off" values.

I don't think that fighting the yaml spec and forcing your boolean to be a string is necessarily the right approach, though Juju does have a facility to win the argument with yaml if you want :-)

Revision history for this message
Erik Lönroth (sssler-scania) wrote :

You are right that a boolean can do it and this is what I resorted to in the end.

It leaves offcourse the ERROR message which would let me know far earlier that some values are not permitted in a string variable, if I get this right?

Harry Pidcock (hpidcock)
Changed in juju:
assignee: Yang Kelvin Liu (kelvin.liu) → nobody
status: In Progress → Triaged
importance: Undecided → Medium
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
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.