cannot run pool-set action when attempting to apply and integer as a value

Bug #1838650 reported by Jeff Hillman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceph Monitor Charm
Fix Released
High
Unassigned

Bug Description

Per the actions.yaml, when running the pool-set action, "Any valid Ceph key from http://docs.ceph.com/docs/master/rados/operations/pools/#set-pool-values" can be used.

However, when running

---

$ juju run-action ceph-mon/0 pool-set name=xfs-pool key=size value=3

---

I get the message "ERROR validation failed: (root).value : must be of type string, given 3"

I have tried putting the 3 in "'s and not change.

Per the above linked ceph doc, this particular value is an integer, not a string.

Tags: cpe-onsite
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

Yup, this can't work looking at the code. The action says that value is a str, but not type conversion is done for ints fro the action type. i.e. the code should attempt to parse the string to the required value, as it can never actually be the value in the validator.

Relevant line: https://github.com/openstack/charm-ceph-mon/blob/86536fb52abf068d815209df790a28ec61025eb5/actions/pool_set.py#L30

This request will always have a str value for the value, but handle_set_pool_value() already expects "request" to be the correct type for the value.

Changed in charm-ceph-mon:
importance: Undecided → High
status: New → Triaged
Changed in charm-ceph-mon:
assignee: nobody → Alex Kavanagh (ajkavanagh)
milestone: none → 20.08
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-mon (master)

Fix proposed to branch: master
Review: https://review.opendev.org/739048

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-mon (master)

Reviewed: https://review.opendev.org/739048
Committed: https://git.openstack.org/cgit/openstack/charm-ceph-mon/commit/?id=b34d85ee81769a39e34d540699d4b5cf392736ae
Submitter: Zuul
Branch: master

commit b34d85ee81769a39e34d540699d4b5cf392736ae
Author: Alex Kavanagh <email address hidden>
Date: Thu Jul 2 14:56:41 2020 +0100

    Enable passing of integer value for pool-set action

    Enable passing of an integer to the pool-set function. Due to how juju
    appears to parse things on the command line, setting type to string
    causes it to fail to accept '3', "3" or 3 as a string. Only "'3'"
    works. However, if we remove the type from actions.yaml and do the
    validation in the charm, any value can be passed.

    Depends-On: I6081c23af61fd5e872982ff477b0a5cb27141d11

    Change-Id: Idf3468d9ae28dafc09c86f08b7f8c6470a665b7a
    Closes-Bug: #1838650

Changed in charm-ceph-mon:
status: In Progress → Fix Committed
Changed in charm-ceph-mon:
assignee: Alex Kavanagh (ajkavanagh) → nobody
Changed in charm-ceph-mon:
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.