Ask Your Question

puppetdb api deactivate node

asked 2014-10-07 00:52:10 -0500

tle gravatar image

updated 2014-10-07 16:22:13 -0500

The example given in the docs of how to deactivate a node ( ) does not work for me. The following error is returned

Missing required query parameter 'payload'

Has anyone used this successfully?


running version: ""

$ curl 'http://localhost:8080/v3/nodes'
}, {
  "name" : "",
  "deactivated" : null,
  "catalog_timestamp" : "2014-10-07T05:34:29.806Z",
  "facts_timestamp" : "2014-10-07T05:34:28.994Z",
  "report_timestamp" : "2014-10-07T05:34:32.971Z"
}, {
$ curl -X POST \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"command":"deactivate node","version":2,"payload":""}' \
>  http://localhost:8080/v3/commands
Missing required query parameter 'payload'
edit retag flag offensive close merge delete


Silly question, but why not use `puppet node deactivate [nodename]` on the CLI?

ken gravatar imageken ( 2014-10-08 05:55:55 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-10-07 14:28:29 -0500

jonn gravatar image

Which version of PuppetDB are you running?

I'm running PE with PuppetDB, so I don't have a version of PuppetDB that supports version 2 of the "deactivate node" command - but this works for me with version 1:

curl -H "Accept: application/json" -d 'payload={"command":"deactivate node","version":1,"payload":"\"\""}' http://localhost:8080/v3/commands

On this version, the payload has to be passed using a parameter called payload, and version 1 of the "deactivate node" command needs the node name to be passed using a serialized JSON string, so you need the extra escaped quotes.

edit flag offensive delete link more


Thanks John. I've tried with a GET request like yours and although i do not receive the error, the node remains in state 'deactivated : null' What I want to do is remove the node completely, is this the correct command for that?

tle gravatar imagetle ( 2014-10-07 16:26:02 -0500 )edit

Yes, it is. My experience is that the node will disappear from PuppetDB completely once deactivated. It might be worth checking the puppetdb log - if it is working, you should see a line saying: [deactivate node]

jonn gravatar imagejonn ( 2014-10-08 01:43:50 -0500 )edit

Thanks John, actually your suggestion did work, but the node remains in the PE console. I can't seem to find and describing these commands or even mapping puppetdb versions to api versions. Are you aware of any?

tle gravatar imagetle ( 2014-10-08 15:42:44 -0500 )edit

Cool, good to hear. Removing nodes from the PE console is a different thing from deactivating it in PuppetDB - you'll need to hit delete on the node in the GUI, or use the rake task (

jonn gravatar imagejonn ( 2014-10-08 16:21:59 -0500 )edit

And for PuppetDB docs, try - this has links to the documentation for each release, and the docs will show the wire formats and API versions that are supported in that version of PuppetDB.

jonn gravatar imagejonn ( 2014-10-08 16:25:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-10-07 00:52:10 -0500

Seen: 566 times

Last updated: Oct 07 '14