trouble getting list of nodes via PE 3.7 Rest API

100 views
Skip to first unread message

Russell Cecala

unread,
Dec 16, 2014, 12:41:17 AM12/16/14
to puppet-users, Red Cricket
Hi,

Hi,

I am trying out the PE 3.7 Rest API and I am unfamiliar with curl. I think I need to execute this ...

# /usr/bin/curl -v -X GET \
> --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem \
> --cert /etc/puppetlabs/puppet/ssl/certs/puppetmaster-1.example.com.pem \
> --key /etc/puppetlabs/puppet/ssl/private_keys/puppetmaster-1.example.com.pem
> --insecure https://puppetmaster-1:443/v1/nodes

... but this results in this output :

/usr/bin/curl -v -X GET --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/certs/puppetmaster-1.example.com.pem --key /etc/puppetlabs/puppet/ssl/private_keys/puppetmaster-1.example.com.pem --insecure https://puppetmaster-1:443/v2/nodes
    * About to connect() to puppetmaster-1 port 443 (#0)
    *   Trying 10.29.120.143... connected
    * Connected to puppetmaster-1 (10.29.120.143) port 443 (#0)
    * Initializing NSS with certpath: sql:/etc/pki/nssdb
    * warning: ignoring value of ssl.verifyhost
    * skipping SSL peer certificate verification
    * SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
    * Server certificate:
    *       subject: CN=puppetmaster-1.example.com
    *       start date: Dec 14 20:36:42 2014 GMT
    *       expire date: Dec 14 20:36:42 2019 GMT
    *       common name: puppetmaster-1.example.com
    *       issuer: CN=Puppet CA generated on puppetmaster-1.example.com at 2014-12-15 12:...
    > GET /v2/nodes HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: puppetmaster-1
    > Accept: */*
    >
    < HTTP/1.1 303 See Other
    < Date: Mon, 15 Dec 2014 23:08:41 GMT
    < Server: Jetty(9.1.z-SNAPSHOT)
    < Location: /auth/login?redirect=%2Fv2%2Fnodes
    < Content-Length: 0
    < Connection: close
    <
    * Closing connection #0

But no node list! I only have one node, my puppetmaster.  What am I doing wrong?

Thanks

Byron Miller

unread,
Dec 16, 2014, 10:02:23 AM12/16/14
to puppet...@googlegroups.com, red.cric...@gmail.com
Looks like you're using puppetDB api to query your puppet master?

try just

puppetmaster:443/{environment}/nodes - environment being "production" or whatever the default env is.

or if querying puppetdb try /v3 api endpoint instead of /v1

Russell Cecala

unread,
Dec 16, 2014, 6:22:26 PM12/16/14
to Byron Miller, puppet-users
I guess I really don't need to list the nodes.  I just wanted to try out the PE3.7 rest api.  What I really need to be able to do is add nodegroups.  I had been using the console rake api for this, but the console rake api is to be depreciated.  I put the details of what I have tried, and what goes wrong here:


I'd really appreciate it if someone could help me out :)  

Eric Sorenson

unread,
Dec 22, 2014, 4:59:08 PM12/22/14
to puppet...@googlegroups.com, byr...@gmail.com
Looks like you got some good responses on your Ask question... All good now?

Russell Cecala

unread,
Dec 22, 2014, 10:59:55 PM12/22/14
to puppet-users
Yep. Thanks all!

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3f3a4dee-74c1-450a-9bf3-44f06e20c641%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages