New <range-in> spec DSL operator feature request

Bug #2052619 reported by Adam Rozman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.utils
Fix Released
Wishlist
Adam Rozman

Bug Description

I would like to propose the addition of an "range-in" operator to grammar used in the "specs_matcher" module of the "oslo_utils" library. The "range_in" operator would test whether the "value string" fits in a inclusive numeric range or not.

The "range_in" operator would compare a single numeric floating point value (x) against 2 other floating point value such as the first floating point value (y) would be an inclusive lower limit of the range while the other value (z) would be the inclusive upper limit of the range. In other words x would be matched successfully against the range if y >= x <= z is true.

An example for the use of the "range-in" operator could be the situation when the user has to specify a range of acceptable disk sizes e.g.
"range-in 500 2000" that would mean that the acceptable disk size for example for a root disk is between 500 GiB and 2000 GiB.

In case such a need would arise, "range-ex" could be added to give the option of a range with exclusive limits such as y > x < z and the naming scheme would stay consistent even in this situation.

EDIT:
Clarifying grammar.

Adam Rozman (rozzix)
Changed in oslo.utils:
assignee: nobody → Adam Rozman (rozzix)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.utils (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/oslo.utils/+/908289

Changed in oslo.utils:
importance: Undecided → Wishlist
Adam Rozman (rozzix)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.utils (master)

Reviewed: https://review.opendev.org/c/openstack/oslo.utils/+/908289
Committed: https://opendev.org/openstack/oslo.utils/commit/72c80f6993714816a33d8ce22019cee5b8180069
Submitter: "Zuul (22348)"
Branch: master

commit 72c80f6993714816a33d8ce22019cee5b8180069
Author: Adam Rozman <email address hidden>
Date: Wed Feb 7 12:55:30 2024 +0200

    add <range-in> spec DSL operator

    Add a new spec DSL operator called `range-in` that allowes users of
    the spec_matcher to match values against numeric ranges.
    The surrounding brackets determines whether the limit should be
    inclusive or not.

    examples:
     <range-in> [ 10 20 ] : 10 <= x <= 20
     <range-in> ( 10 20 ] : 10 < x <= 20
     <range-in> [ 10 20 ) : 10 <= x < 20
     <range-in> ( 10 20 ) : 10 < x < 20

    Closes-Bug: #2052619
    Change-Id: I444c01219d02ea7572d4b82117b89b8d3eb75e56
    Signed-off-by: Adam Rozman <email address hidden>
    Co-authored-by: Takashi Kajinami <email address hidden>

Changed in oslo.utils:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.utils 7.1.0

This issue was fixed in the openstack/oslo.utils 7.1.0 release.

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.