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

The node_state parameter causes an error in conditional statements

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: PDB 5.0.1
    • Fix Version/s: PDB 5.1.5, PDB 5.2.2
    • Component/s: PuppetDB
    • Labels:
      None
    • Template:
    • Team:
      Data Platform
    • Sprint:
      Data Platform 2018-04-11
    • Method Found:
      Customer Feedback
    • CS Priority:
      Major
    • CS Frequency:
      3 - 25-50% of Customers
    • CS Severity:
      3 - Serious
    • CS Business Value:
      5 - $$$$$$
    • CS Impact:
      Hide
      Customers with audit requirements or who need to understand what happened with an inactive node often want to query for inactive nodes.

      It's unclear if there is a workaround for this. If not then it may not be possible to get at this data. The priority of this ticket may rise as larger customers with audit requirements begin to upgrade to the versions where this bug is present.
      Show
      Customers with audit requirements or who need to understand what happened with an inactive node often want to query for inactive nodes. It's unclear if there is a workaround for this. If not then it may not be possible to get at this data. The priority of this ticket may rise as larger customers with audit requirements begin to upgrade to the versions where this bug is present.
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Passing the 'node_state' filter criteria as part of a conjuction operator, 'and' and 'or', didn't work; now it does.
    • QA Risk Assessment:
      Needs Assessment

      Description

      The node_state query parameter introduced as part of PDB-3420 causes an error when used as part of a conditional in a PQL query.

      Reproduction Case

      • Install a PE 2017.3.2 all-in-one master.
      • Generate a test certname, populate data for it in PuppetDB, then deactivate it:

      /opt/puppetlabs/bin/puppet cert generate node-state-query.test
       
      /opt/puppetlabs/bin/puppet agent -t --noop --certname node-state-query.test
       
      /opt/puppetlabs/bin/puppet node deactivate node-state-query.test
      

      • Query PuppetDB for data from the inactive node:

      puppet query 'nodes { certname = "node-state-query.test" and node_state = "any" }'
      

      Outcome

      The query fails with a parsing error:

      # /opt/puppetlabs/bin/puppet query 'nodes { certname = "node-state-query.test" and node_state = "any" }'
      Error response 400 Bad Request from server: [] is not well-formed: queries must contain at least one operator
      

      Expected Outcome

      The query returns node data for the deactivated node that matches the output from a query that does not use a conditional:

      # /opt/puppetlabs/bin/puppet query 'nodes { node_state = "inactive" }'
      [
        {
          "deactivated": "2018-01-17T17:11:34.384Z",
          "latest_report_hash": "035dce81729336f76f784239a655f4e2603a309e",
          "facts_environment": "production",
          "cached_catalog_status": "not_used",
          "report_environment": "production",
          "latest_report_corrective_change": false,
          "catalog_environment": "production",
          "facts_timestamp": "2018-01-17T17:11:30.581Z",
          "latest_report_noop": true,
          "expired": null,
          "latest_report_noop_pending": true,
          "report_timestamp": "2018-01-17T17:11:28.127Z",
          "certname": "node-state-query.test",
          "catalog_timestamp": "2018-01-17T17:11:31.526Z",
          "latest_report_status": "unchanged"
        }
      ]
      

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                rob.browning Rob Browning
                Reporter:
                chuck Charlie Sharpsteen
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: