Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-1391

Inconsistent behaviour of the distinct_resources request parameter

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 3.0.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      3
    • Sprint:
      PuppetDB 2015-05-06

      Description

      Error messages returned by PuppetDB are not conclusive/consistent enough about the use of the distinct_resources request parameter. See the following example queries (which only differ in the distinct_resources parameter) and the corresponding responses returned by PuppetDB:

      • distinct_resources query parameter not specified

        curl -i -gG http://localhost:8080/v4/aggregate-event-counts --data-urlencode 'distinct_start_time=2015-04-02T21:48:24Z' --data-urlencode 'distinct_end_time=2015-04-03T21:48:24Z' --data-urlencode 'query=["<","report_receive_time","2015-04-03T21:48:24Z"]' --data-urlencode 'summarize_by=containing_class' 
        HTTP/1.1 500 'distinct_resources' query parameter requires accompanying parameters 'distinct_start_time' and 'distinct_end_time'
        Date: Fri, 03 Apr 2015 23:01:32 GMT
        Cache-Control: must-revalidate,no-cache,no-store
        Content-Type: text/html; charset=ISO-8859-1
        Content-Length: 409
        Connection: close
        Server: Jetty(9.2.10.v20150310)
         
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
        <title>Error 500 </title>
        </head>
        <body>
        <h2>HTTP ERROR: 500</h2>
        <p>Problem accessing /v4/aggregate-event-counts. Reason:
        <pre>    'distinct_resources' query parameter requires accompanying parameters 'distinct_start_time' and 'distinct_end_time'</pre></p>
        <hr /><i><small>Powered by Jetty://</small></i>
        </body>
        </html>
        

      • distinct_resources=false

        curl -i -gG http://localhost:8080/v4/aggregate-event-counts --data-urlencode 'distinct_start_time=2015-04-02T21:48:24Z' --data-urlencode 'distinct_end_time=2015-04-03T21:48:24Z' --data-urlencode 'query=["<","report_receive_time","2015-04-03T21:48:24Z"]' --data-urlencode 'summarize_by=containing_class' --data-urlencode 'distinct_resources=false'
        HTTP/1.1 200 OK
        Date: Fri, 03 Apr 2015 23:02:08 GMT
        Content-Type: application/json; charset=utf-8
        Content-Length: 84
        Server: Jetty(9.2.10.v20150310)
         
        {
          "successes" : 1,
          "failures" : 5,
          "noops" : 1,
          "skips" : 2,
          "total" : 6
        }
        

      • distinct_resources=true

        curl -i -gG http://localhost:8080/v4/aggregate-event-counts --data-urlencode 'distinct_start_time=2015-04-02T21:48:24Z' --data-urlencode 'distinct_end_time=2015-04-03T21:48:24Z' --data-urlencode 'query=["<","report_receive_time","2015-04-03T21:48:24Z"]' --data-urlencode 'summarize_by=containing_class' --data-urlencode 'distinct_resources=true'
        HTTP/1.1 400 Bad Request
        Date: Fri, 03 Apr 2015 23:02:30 GMT
        Content-Length: 76
        Server: Jetty(9.2.10.v20150310)
         
        < operator does not support object 'report_receive_time' for resource event
        

      Note that the last example is reported separately as PDB-1390

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                michal.ruzicka Michal Ruzicka
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: