Jira (PDB-4389) Query for deactivated nodes

12 views
Skip to first unread message

Maheswaran Shanmugam (JIRA)

unread,
Jun 2, 2019, 11:43:03 PM6/2/19
to puppe...@googlegroups.com
Maheswaran Shanmugam created an issue
 
PuppetDB / Improvement PDB-4389
Query for deactivated nodes
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2019/06/02 8:42 PM
Environment:

This test is carried out on

PE 2018.1.8
puppetdb version: 5.2.8
puppet-query v1.2.5

Priority: Normal Normal
Reporter: Maheswaran Shanmugam

Hello,

puppet query command is not listing out deactivated or expired nodes.

[root@pe-201818-master ~]# puppet query 'nodes[]

{ deactivated is not null }'
[]
[root@pe-201818-master ~]# puppet query 'nodes[] { deactivated is not null or expired is not null }'
[]

Steps followed to reproduce:
1) puppet query all nodes.
```puppet query "nodes[certname] {}"```

2) Manually deactivate the node
```puppet node deactivate <nodename>```

3) Run puppet query looking for the node marked "deactivated is not null"
```puppet query 'nodes[] { deactivated is not null }

'```

4) Login into pe-puppetdb and select specific node from ```certnames``` table to ensure this node is deactiviated.
```
[root@pe-201818-master ~]# su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/bin/psql -d pe-puppetdb"
psql (9.6.12)
Type "help" for help.
pe-puppetdb=# select * from certnames where certname = 'yc3ctpdm4eyv3ni.delivery.puppetlabs.net';
id | certname | latest_report_id | deactivated | expired | package_hash | latest_report_timestamp
----------------------------------------------------------------------------------------------------------------------------------
3 | yc3ctpdm4eyv3ni.delivery.puppetlabs.net | 120 | 2019-06-02 20:11:35.303-07 | | | 2019-05-29 08:48:05.553-07
(1 row)
```

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Maheswaran Shanmugam (JIRA)

unread,
Jun 2, 2019, 11:54:03 PM6/2/19
to puppe...@googlegroups.com
Maheswaran Shanmugam commented on Improvement PDB-4389
 
Re: Query for deactivated nodes

This ticket is raised to address the customer ticket "https://puppetlabs.zendesk.com/agent/tickets/34919". The nodes are showing in puppetdb and console. However, it's not getting deleted when purging.

Austin Blatt (JIRA)

unread,
Jun 3, 2019, 12:32:03 PM6/3/19
to puppe...@googlegroups.com
Austin Blatt commented on Improvement PDB-4389

Hi Maheswaran Shanmugam, you will need to add node_state = "inactive" to your query because deactivated is not null will not work on its own on nodes endpoint because by default the endpoint only includes active nodes. We likely need to improve our docs because it is difficult to find the proper query for deactivated nodes so I've included a few examples here.

So the full query for all deactivated and expired nodes, would look like

{{nodes[certname]

{ node_state = "inactive"}

}}

If you only want the deactivated nodes it'd look like

nodes[certname] { node_state = "inactive" and deactivated is not null}

Let me know if this fixes your issue.

Maheswaran Shanmugam (JIRA)

unread,
Jun 12, 2019, 10:28:03 PM6/12/19
to puppe...@googlegroups.com

Austin Blatt Can you suggest how to remove these nodes permanently from the console and db. This behaviour is fixed with the latest release as
per Jira ticket # PDB-4390 "https://tickets.puppetlabs.com/browse/PDB-4390"

Austin Blatt (JIRA)

unread,
Jun 13, 2019, 12:19:03 PM6/13/19
to puppe...@googlegroups.com
Austin Blatt commented on Improvement PDB-4389

Maheswaran Shanmugam Unfortunately, there's no easy way to fix that bug. Every time a node that is triggering that bug submits a catalog the node will be re-created and you'll see it in the console again. Currently, you'll have to downgrade to 2018.1.7 (or lower), or wait for 2018.1.9 to be released.

Jarret Lavallee (Jira)

unread,
Feb 3, 2021, 1:36:03 PM2/3/21
to puppe...@googlegroups.com

Austin Blatt Would it be possible to get node_state documented into the query parameters of https://puppet.com/docs/puppetdb/6.3/api/query/v4/nodes.html#query-fields? I think that is auto generated from https://github.com/puppetlabs/puppetdb/blob/6.x/documentation/api/query/v4/nodes.markdown

I suspect we can close this ticket out if customers can find it in the docs.

It would be nice to have an example in https://puppet.com/docs/puppetdb/6.3/api/query/examples-pql.html. The example could help customers identify expired nodes.

nodes[certname] { node_state = "inactive" and expired is not null }

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages