Puppet API to delete Role fails

asked 2015-07-26 23:34:09 -0500

geminiguy gravatar image

Hi All,

In Puppet Enterprise 3.7.2,am trying to delete a Role from Puppet using curl and Puppet API call as below. But this doesn't seem to work. Has anyone got the Role deletion working using APIs ?

curl -k -X DELETE -H "Accept: pson" --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem --cert /opt/puppet/share/puppet-dashboard/certs/pe-internal-dashboard.cert.pem --key /opt/puppet/share/puppet-dashboard/certs/pe-internal-dashboard.private_key.pem https://puppetmasterhost:4433/rbac-ap... where 53 is the roleID that I am trying to delete

Thanks, Geminiguy

edit retag flag offensive close merge delete


What status code is returned to you by the server? Do you see one of the errors listed here: http://docs.puppetlabs.com/pe/3.7/rbac_serviceerrors.html ?

GregLarkin gravatar imageGregLarkin ( 2015-07-27 23:05:33 -0500 )edit

This page https://docs.puppetlabs.com/pe/3.7/rbac_serviceerrors.html indicates that you should have "Accept: application/json" instead of "Accept: pson". "Accept: pson" is used with the HTTP API. Also, is puppetmasterhost hosting the PE console services?

GregLarkin gravatar imageGregLarkin ( 2015-07-27 23:12:09 -0500 )edit

Thanks Greg, Am trying these API steps on a monolithic environment. So all components are on the same host. Trying with curl -i -X DELETE -H 'Content-Type: application/json' --data '{"id": "54"}'... returns a HTTP/1.1 405 Method Not Allowed Date: Tue, 28 Jul 2015 05:20:57 GMT

geminiguy gravatar imagegeminiguy ( 2015-07-28 00:30:45 -0500 )edit

Try changing "Content-Type" to "Accept", and I don't think the DELETE endpoint uses data in the body of the request. You should just specify the original URL you were using, AFAICT.

GregLarkin gravatar imageGregLarkin ( 2015-07-29 00:46:22 -0500 )edit