Hello, all I''m trying to use puppetdb''s deactivate api call but can''t find how to correctly pass node name via payload. Calls like `curl -G -H "Accept: application/json" ''http://localhost:8080/v2/commands'' --data-urlencode ''{ "command": "deactivate node", "version": 1, "payload": { "name": "nodename.domain.tld" } }''` returns ''missing payload'' error. Perhaps, key name is wrong, but in the documentation there are just ''JSON string'', without any key names. http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1 Could anybody give the real example how to use this call? Thanks! --- Alexander Grushin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Try: curl -vv -G -H "Accept: application/json" ''http://localhost:8080/v2/commands'' --data-urlencode ''payload={"command":"deactivate node","version": 1,"payload":"\"yournodename\""}'' The command needs to be submitted with the form parameter ''payload''. The ''payload'' part of the command is itself a JSON serialised string (hence the extra quotes and escaping). ken. On Wed, Mar 27, 2013 at 6:46 AM, Alexander Grushin <a.grushin@gmail.com> wrote:> Hello, all > > I''m trying to use puppetdb''s deactivate api call but can''t find how to > correctly pass node name via payload. > > Calls like > `curl -G -H "Accept: application/json" ''http://localhost:8080/v2/commands'' > --data-urlencode ''{ "command": "deactivate node", "version": 1, "payload": { > "name": "nodename.domain.tld" } }''` > returns ''missing payload'' error. > > Perhaps, key name is wrong, but in the documentation there are just ''JSON > string'', without any key names. > http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1 > > Could anybody give the real example how to use this call? > > Thanks! > > --- > Alexander Grushin > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Here is a better working example as a gist, with what you should see in the puppetdb.log if it was successful: https://gist.github.com/kbarber/5254512 On Wed, Mar 27, 2013 at 2:19 PM, Ken Barber <ken@puppetlabs.com> wrote:> Try: > > curl -vv -G -H "Accept: application/json" > ''http://localhost:8080/v2/commands'' --data-urlencode > ''payload={"command":"deactivate node","version": > 1,"payload":"\"yournodename\""}'' > > The command needs to be submitted with the form parameter ''payload''. > The ''payload'' part of the command is itself a JSON serialised string > (hence the extra quotes and escaping). > > ken. > > On Wed, Mar 27, 2013 at 6:46 AM, Alexander Grushin <a.grushin@gmail.com> wrote: >> Hello, all >> >> I''m trying to use puppetdb''s deactivate api call but can''t find how to >> correctly pass node name via payload. >> >> Calls like >> `curl -G -H "Accept: application/json" ''http://localhost:8080/v2/commands'' >> --data-urlencode ''{ "command": "deactivate node", "version": 1, "payload": { >> "name": "nodename.domain.tld" } }''` >> returns ''missing payload'' error. >> >> Perhaps, key name is wrong, but in the documentation there are just ''JSON >> string'', without any key names. >> http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1 >> >> Could anybody give the real example how to use this call? >> >> Thanks! >> >> --- >> Alexander Grushin >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to puppet-users+unsubscribe@googlegroups.com. >> To post to this group, send email to puppet-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Alexander Grushin
2013-Mar-28 06:31 UTC
Re: [Puppet Users] PuppetDB api - deactivate command
Great! Thank you a lot! It works! On Wednesday, March 27, 2013 6:21:09 PM UTC+4, Ken Barber wrote:> > Here is a better working example as a gist, with what you should see > in the puppetdb.log if it was successful: > > https://gist.github.com/kbarber/5254512 > > On Wed, Mar 27, 2013 at 2:19 PM, Ken Barber <k...@puppetlabs.com<javascript:>> > wrote: > > Try: > > > > curl -vv -G -H "Accept: application/json" > > ''http://localhost:8080/v2/commands'' --data-urlencode > > ''payload={"command":"deactivate node","version": > > 1,"payload":"\"yournodename\""}'' > > > > The command needs to be submitted with the form parameter ''payload''. > > The ''payload'' part of the command is itself a JSON serialised string > > (hence the extra quotes and escaping). > > > > ken. > > > > On Wed, Mar 27, 2013 at 6:46 AM, Alexander Grushin <a.gr...@gmail.com<javascript:>> > wrote: > >> Hello, all > >> > >> I''m trying to use puppetdb''s deactivate api call but can''t find how to > >> correctly pass node name via payload. > >> > >> Calls like > >> `curl -G -H "Accept: application/json" '' > http://localhost:8080/v2/commands'' > >> --data-urlencode ''{ "command": "deactivate node", "version": 1, > "payload": { > >> "name": "nodename.domain.tld" } }''` > >> returns ''missing payload'' error. > >> > >> Perhaps, key name is wrong, but in the documentation there are just > ''JSON > >> string'', without any key names. > >> > http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1 > >> > >> Could anybody give the real example how to use this call? > >> > >> Thanks! > >> > >> --- > >> Alexander Grushin > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Puppet Users" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to puppet-users...@googlegroups.com <javascript:>. > >> To post to this group, send email to puppet...@googlegroups.com<javascript:>. > > >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Right time for this :) If I''m running this outside the localhost, do I need any specific auth permission ? Regards, Felipe On Wednesday, March 27, 2013 7:21:09 AM UTC-7, Ken Barber wrote:> > Here is a better working example as a gist, with what you should see > in the puppetdb.log if it was successful: > > https://gist.github.com/kbarber/5254512 > > On Wed, Mar 27, 2013 at 2:19 PM, Ken Barber <k...@puppetlabs.com<javascript:>> > wrote: > > Try: > > > > curl -vv -G -H "Accept: application/json" > > ''http://localhost:8080/v2/commands'' --data-urlencode > > ''payload={"command":"deactivate node","version": > > 1,"payload":"\"yournodename\""}'' > > > > The command needs to be submitted with the form parameter ''payload''. > > The ''payload'' part of the command is itself a JSON serialised string > > (hence the extra quotes and escaping). > > > > ken. > > > > On Wed, Mar 27, 2013 at 6:46 AM, Alexander Grushin <a.gr...@gmail.com<javascript:>> > wrote: > >> Hello, all > >> > >> I''m trying to use puppetdb''s deactivate api call but can''t find how to > >> correctly pass node name via payload. > >> > >> Calls like > >> `curl -G -H "Accept: application/json" '' > http://localhost:8080/v2/commands'' > >> --data-urlencode ''{ "command": "deactivate node", "version": 1, > "payload": { > >> "name": "nodename.domain.tld" } }''` > >> returns ''missing payload'' error. > >> > >> Perhaps, key name is wrong, but in the documentation there are just > ''JSON > >> string'', without any key names. > >> > http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1 > >> > >> Could anybody give the real example how to use this call? > >> > >> Thanks! > >> > >> --- > >> Alexander Grushin > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Puppet Users" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to puppet-users...@googlegroups.com <javascript:>. > >> To post to this group, send email to puppet...@googlegroups.com<javascript:>. > > >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Deepak Giridharagopal
2013-Mar-28 16:25 UTC
Re: [Puppet Users] PuppetDB api - deactivate command
On Thu, Mar 28, 2013 at 10:20 AM, Felipe Salum <fsalum@gmail.com> wrote:> Right time for this :) > > If I''m running this outside the localhost, do I need any specific auth > permission ? >Yes, you''ll need to hit PuppetDB''s HTTPS port (8081 by default) and you''ll have to supply a client certificate. Here''s the relevant section from the manual: http://docs.puppetlabs.com/puppetdb/1.1/api/query/curl.html#using-curl-from-remote-hosts-sslhttps deepak> > Regards, > Felipe > > > On Wednesday, March 27, 2013 7:21:09 AM UTC-7, Ken Barber wrote: > >> Here is a better working example as a gist, with what you should see >> in the puppetdb.log if it was successful: >> >> https://gist.github.com/**kbarber/5254512<https://gist.github.com/kbarber/5254512> >> >> On Wed, Mar 27, 2013 at 2:19 PM, Ken Barber <k...@puppetlabs.com> wrote: >> > Try: >> > >> > curl -vv -G -H "Accept: application/json" >> > ''http://localhost:8080/v2/**commands<http://localhost:8080/v2/commands>'' >> --data-urlencode >> > ''payload={"command":"**deactivate node","version": >> > 1,"payload":"\"yournodename\""**}'' >> > >> > The command needs to be submitted with the form parameter ''payload''. >> > The ''payload'' part of the command is itself a JSON serialised string >> > (hence the extra quotes and escaping). >> > >> > ken. >> > >> > On Wed, Mar 27, 2013 at 6:46 AM, Alexander Grushin <a.gr...@gmail.com> >> wrote: >> >> Hello, all >> >> >> >> I''m trying to use puppetdb''s deactivate api call but can''t find how to >> >> correctly pass node name via payload. >> >> >> >> Calls like >> >> `curl -G -H "Accept: application/json" ''http://localhost:8080/v2/** >> commands <http://localhost:8080/v2/commands>'' >> >> --data-urlencode ''{ "command": "deactivate node", "version": 1, >> "payload": { >> >> "name": "nodename.domain.tld" } }''` >> >> returns ''missing payload'' error. >> >> >> >> Perhaps, key name is wrong, but in the documentation there are just >> ''JSON >> >> string'', without any key names. >> >> http://docs.puppetlabs.com/**puppetdb/1.1/api/commands.** >> html#deactivate-node-version-1<http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1> >> >> >> >> Could anybody give the real example how to use this call? >> >> >> >> Thanks! >> >> >> >> --- >> >> Alexander Grushin >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Puppet Users" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> an >> >> email to puppet-users...@**googlegroups.com. >> >> To post to this group, send email to puppet...@googlegroups.com. >> >> Visit this group at http://groups.google.com/** >> group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>. >> >> >> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>. >> >> >> >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Great, thanks Deepak. On Thursday, March 28, 2013 9:25:49 AM UTC-7, Deepak Giridharagopal wrote:> > On Thu, Mar 28, 2013 at 10:20 AM, Felipe Salum <fsa...@gmail.com<javascript:> > > wrote: > >> Right time for this :) >> >> If I''m running this outside the localhost, do I need any specific auth >> permission ? >> > > Yes, you''ll need to hit PuppetDB''s HTTPS port (8081 by default) and you''ll > have to supply a client certificate. Here''s the relevant section from the > manual: > > > http://docs.puppetlabs.com/puppetdb/1.1/api/query/curl.html#using-curl-from-remote-hosts-sslhttps > > deepak > > >> >> Regards, >> Felipe >> >> >> On Wednesday, March 27, 2013 7:21:09 AM UTC-7, Ken Barber wrote: >> >>> Here is a better working example as a gist, with what you should see >>> in the puppetdb.log if it was successful: >>> >>> https://gist.github.com/**kbarber/5254512<https://gist.github.com/kbarber/5254512> >>> >>> On Wed, Mar 27, 2013 at 2:19 PM, Ken Barber <k...@puppetlabs.com> >>> wrote: >>> > Try: >>> > >>> > curl -vv -G -H "Accept: application/json" >>> > ''http://localhost:8080/v2/**commands<http://localhost:8080/v2/commands>'' >>> --data-urlencode >>> > ''payload={"command":"**deactivate node","version": >>> > 1,"payload":"\"yournodename\""**}'' >>> > >>> > The command needs to be submitted with the form parameter ''payload''. >>> > The ''payload'' part of the command is itself a JSON serialised string >>> > (hence the extra quotes and escaping). >>> > >>> > ken. >>> > >>> > On Wed, Mar 27, 2013 at 6:46 AM, Alexander Grushin <a.gr...@gmail.com> >>> wrote: >>> >> Hello, all >>> >> >>> >> I''m trying to use puppetdb''s deactivate api call but can''t find how >>> to >>> >> correctly pass node name via payload. >>> >> >>> >> Calls like >>> >> `curl -G -H "Accept: application/json" ''http://localhost:8080/v2/** >>> commands <http://localhost:8080/v2/commands>'' >>> >> --data-urlencode ''{ "command": "deactivate node", "version": 1, >>> "payload": { >>> >> "name": "nodename.domain.tld" } }''` >>> >> returns ''missing payload'' error. >>> >> >>> >> Perhaps, key name is wrong, but in the documentation there are just >>> ''JSON >>> >> string'', without any key names. >>> >> http://docs.puppetlabs.com/**puppetdb/1.1/api/commands.** >>> html#deactivate-node-version-1<http://docs.puppetlabs.com/puppetdb/1.1/api/commands.html#deactivate-node-version-1> >>> >> >>> >> Could anybody give the real example how to use this call? >>> >> >>> >> Thanks! >>> >> >>> >> --- >>> >> Alexander Grushin >>> >> >>> >> -- >>> >> You received this message because you are subscribed to the Google >>> Groups >>> >> "Puppet Users" group. >>> >> To unsubscribe from this group and stop receiving emails from it, >>> send an >>> >> email to puppet-users...@**googlegroups.com. >>> >> To post to this group, send email to puppet...@googlegroups.com. >>> >> Visit this group at http://groups.google.com/** >>> group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>. >>> >>> >> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>. >>> >>> >> >>> >> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to puppet-users...@googlegroups.com <javascript:>. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.