Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-60657

unable to filter on optional fields in o2ims endpoints

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.20
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      When attempting to filter a list on optional fields, such as with 
      
      /o2ims-infrastructureMonitoring/v1/alarmSubscriptions?filter=(eq,filter,'ACKNOWLEDGE')
      
      , the API returns
      
      {
        "detail": "failed to evaluate selector: failed to evaluate 'filter': map doesn't have a 'filter' key",
        "status": 400
      }
      
      . This seems to be a result of internal/search/path_evaluator.go:133, where the fact that the field does not get returned for some objects means that it fails the query on all objects.
      
      Although this bug references AlarmSubscriptionInfo, it really applies to any object with filtering.

      Code permalink

      Version-Release number of selected component (if applicable):

      every o-cloud-manager release with filtering it seems

      How reproducible:

      100%

      Steps to Reproduce:

          1. Perform API request as in the description where only some alarmSubscriptions have a filter specified
          2. Observe API result as in the description
      

      Actual results:

      400 Bad Request

      Expected results:

      As per v8 of the spec,
      
      All attribute names that appear in the AlarmSubscriptionInfo and in data
      types referenced from it shall be supported by the O-Cloud in the filter
      expression.
      
      I would expect a null/missing value to be incomparable and always not equal to other values, similar to how NaNs get handled. This means that querying (eq,'filter',ACKNOWLEDGE) would not include AlarmSubscriptionInfo without filter attributes but (neq,'filter',ACKNOWLEDGE) would include all matching AlarmSubscriptionInfo objects and every AlarmSubscriptionInfo without a filter attribute.

      Additional info:

       

              rh-ee-alegacy Allain Legacy
              rh-ee-klaskosk Kirsten Laskoski
              None
              None
              Kirsten Laskoski Kirsten Laskoski
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: