Jira (PDB-3808) The node_state parameter causes an error in conditional statements

8 views
Skip to first unread message

Charlie Sharpsteen (JIRA)

unread,
Jan 17, 2018, 12:18:37 PM1/17/18
to puppe...@googlegroups.com
Charlie Sharpsteen created an issue
 
PuppetDB / Bug PDB-3808
The node_state parameter causes an error in conditional statements
Issue Type: Bug Bug
Affects Versions: PDB 5.0.1
Assignee: Unassigned
Components: PuppetDB
Created: 2018/01/17 9:17 AM
Priority: Major Major
Reporter: Charlie Sharpsteen

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 = "deactivation.test" and node_state = "any" }'

Outcome

The query fails with a parsing error:

# /opt/puppetlabs/bin/puppet query 'nodes { certname = "deactivation.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"
  }
]

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db)
Atlassian logo

Charlie Sharpsteen (JIRA)

unread,
Jan 17, 2018, 12:20:10 PM1/17/18
to puppe...@googlegroups.com

Jeff Yarnell (JIRA)

unread,
Jan 17, 2018, 4:59:03 PM1/17/18
to puppe...@googlegroups.com

Charlie Sharpsteen (JIRA)

unread,
Jan 17, 2018, 6:19:02 PM1/17/18
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
Change By: Charlie Sharpsteen
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.

h2. 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:

{code:bash}

/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
{code}

  - Query PuppetDB for data from the inactive node:

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

h3. Outcome


The query fails with a parsing error:

{noformat}

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

h3. Expected Outcome


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

{noformat}

# /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"
  }
]
{noformat}

Charlie Sharpsteen (JIRA)

unread,
Jan 17, 2018, 6:20:03 PM1/17/18
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
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.

h2. 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:

{code:bash}
/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
{code}

  - Query PuppetDB for data from the inactive node:

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

{code}

h3. Outcome

The query fails with a parsing error:

{noformat}
# /opt/puppetlabs/bin/puppet query 'nodes { certname = " deactivation node-state-query .test" and node_state = "any" }'

Owen Rodabaugh (JIRA)

unread,
Jan 18, 2018, 7:27:02 PM1/18/18
to puppe...@googlegroups.com
Owen Rodabaugh updated an issue
Change By: Owen Rodabaugh
CS Priority: Needs Priority Major
CS Impact: 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.
CS Severity: 3 - Serious
CS Business Value: 5 - $$$$$$
CS Frequency: 3 - 25-50% of Customers

Owen Rodabaugh (JIRA)

unread,
Feb 8, 2018, 7:34:02 PM2/8/18
to puppe...@googlegroups.com
Owen Rodabaugh updated an issue
Change By: Owen Rodabaugh
Team: Data Platform
This message was sent by Atlassian JIRA (v7.5.1#75006-sha1:7df2574)
Atlassian logo

Yasmin Rajabi (JIRA)

unread,
Mar 29, 2018, 1:53:02 PM3/29/18
to puppe...@googlegroups.com
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

AJ Roetker (JIRA)

unread,
Mar 29, 2018, 5:42:04 PM3/29/18
to puppe...@googlegroups.com

AJ Roetker (JIRA)

unread,
Mar 29, 2018, 5:43:04 PM3/29/18
to puppe...@googlegroups.com

Jeff Yarnell (JIRA)

unread,
Mar 29, 2018, 6:21:03 PM3/29/18
to puppe...@googlegroups.com

Jeff Yarnell (JIRA)

unread,
Mar 29, 2018, 6:21:04 PM3/29/18
to puppe...@googlegroups.com
Jeff Yarnell updated an issue
Change By: Jeff Yarnell
Sprint: Hopper/Triage Data Platform 2018-04-11

Jeff Yarnell (JIRA)

unread,
Mar 29, 2018, 6:29:04 PM3/29/18
to puppe...@googlegroups.com
Jeff Yarnell updated an issue
Change By: Jeff Yarnell
Fix Version/s: PDB 5.2.2
Fix Version/s: PDB 5.1.5

Kenn Hussey (JIRA)

unread,
Apr 3, 2018, 11:00:04 AM4/3/18
to puppe...@googlegroups.com
Kenn Hussey commented on Bug PDB-3808
 
Re: The node_state parameter causes an error in conditional statements

AJ Roetker I assume this fix would need to be merged up to PDB 5.2.2 as well (in which case it also needs the PDB 5.2.2 fix version)?

Jeff Yarnell (JIRA)

unread,
Apr 3, 2018, 11:31:04 AM4/3/18
to puppe...@googlegroups.com

Kenn Hussey (JIRA)

unread,
Apr 4, 2018, 12:20:06 PM4/4/18
to puppe...@googlegroups.com

Kenn Hussey (JIRA)

unread,
Apr 10, 2018, 4:58:04 PM4/10/18
to puppe...@googlegroups.com
Kenn Hussey commented on Bug PDB-3808
 
Re: The node_state parameter causes an error in conditional statements

AJ Roetker please add release notes for this issue, if needed. Thanks!

Kenn Hussey (JIRA)

unread,
Apr 11, 2018, 9:43:02 AM4/11/18
to puppe...@googlegroups.com
Kenn Hussey commented on Bug PDB-3808

AJ Roetker Rob Browning has this fix been merged up to 5.2.2 yet? Note also that release notes (if needed) still have to be added.

Rob Browning (JIRA)

unread,
Apr 11, 2018, 11:24:02 AM4/11/18
to puppe...@googlegroups.com
Rob Browning commented on Bug PDB-3808

Kenn Hussey Not yet, but we're going to be getting the last 5.2 pr merged today (likely in the next few hours), and then I'll merge up 5.1.x to 5.2.x, and 5.2.x to master, and after that I think we should be ready.

Russell Mull (JIRA)

unread,
Apr 11, 2018, 12:11:05 PM4/11/18
to puppe...@googlegroups.com

Russell Mull (JIRA)

unread,
Apr 11, 2018, 12:15:07 PM4/11/18
to puppe...@googlegroups.com
Russell Mull updated an issue
Change By: Russell Mull
Release Notes Summary: Passing the 'node_state' filter criteria as part of an 'and' with another didn't work; now it does.

Kenn Hussey (JIRA)

unread,
Apr 11, 2018, 12:18:04 PM4/11/18
to puppe...@googlegroups.com

AJ Roetker (JIRA)

unread,
Apr 11, 2018, 3:20:04 PM4/11/18
to puppe...@googlegroups.com
AJ Roetker updated an issue
Change By: AJ Roetker
Release Notes Summary: Passing the 'node_state' filter criteria as part of an a conjuction operator, 'and' with another and 'or', didn't work; now it does.

Rob Browning (JIRA)

unread,
Jul 29, 2019, 2:30:05 PM7/29/19
to puppe...@googlegroups.com
Rob Browning assigned an issue to Rob Browning
Change By: Rob Browning
Resolution: Fixed
Assignee: AJ Roetker Rob Browning
Status: Accepted Resolved

Rob Browning (JIRA)

unread,
Jul 29, 2019, 2:31:09 PM7/29/19
to puppe...@googlegroups.com
Rob Browning commented on Bug PDB-3808
 
Re: The node_state parameter causes an error in conditional statements

Looks like it just didn't get closed properly – closing now.

Reply all
Reply to author
Forward
0 new messages