How to update class parameters through API in Puppet Foreman?

Hi Joseph,

To update host parameters through the API, you need Version 2, which is not the default in Foreman 1.1. You need to pass 'version=2' in the header as shown below:

Btw, the screenshot that you attached shows host parameters, which are different than puppet class parameters (called smart variables)

curl -u admin:secret -H 'Accept:application/json,version=2' -H "Content-Type:application/json" -X PUT -d "{"value":"newstring"}" https://puppet-dev/api/hosts/illum-qa-echo.softek.local/parameters/clinical_findings

Also, you can get all the host parameters with this:

curl -u admin:secret -H 'Accept:application/json,version=2' https://puppet-dev/api/hosts/illum-qa-echo.softek.local/parameters

Regards,

Joseph Magen
Redhat

··· ----- Original Message ----- From: "Joseph Andaverde" To: foreman-dev@googlegroups.com Sent: Friday, May 17, 2013 5:11:50 PM Subject: [foreman-dev] How to update class parameters through API in Puppet Foreman?

I would like to be able to update the class parameters for a specific host
through the foreman api. I can’t seem to find a way to do this despite
hours of google searching and trial/error.

For example, in the screenshot attached I’d like to update
"clinical_findings" version to something other than “latest”.


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Joseph,

On second thought, I see now that that in your example, "clinical_findings" is a puppetclass class parameter (stored in the lookup_keys table) and not a host parameter (stored in the parameters table). The API v2 is still not complete and does not yet include functionality for modifying class parameters.

Regards,

Joseph

··· ----- Original Message ----- From: "Joseph Magen" To: foreman-dev@googlegroups.com Sent: Sunday, May 19, 2013 7:23:08 PM Subject: Re: [foreman-dev] How to update class parameters through API in Puppet Foreman?

Hi Joseph,

To update host parameters through the API, you need Version 2, which is not the default in Foreman 1.1. You need to pass ‘version=2’ in the header as shown below:

Btw, the screenshot that you attached shows host parameters, which are different than puppet class parameters (called smart variables)

curl -u admin:secret -H ‘Accept:application/json,version=2’ -H “Content-Type:application/json” -X PUT -d “{“value”:“newstring”}” https://puppet-dev/api/hosts/illum-qa-echo.softek.local/parameters/clinical_findings

Also, you can get all the host parameters with this:

curl -u admin:secret -H ‘Accept:application/json,version=2’ https://puppet-dev/api/hosts/illum-qa-echo.softek.local/parameters

Regards,

Joseph Magen
Redhat

----- Original Message -----
From: “Joseph Andaverde” joe@andaverde.net
To: foreman-dev@googlegroups.com
Sent: Friday, May 17, 2013 5:11:50 PM
Subject: [foreman-dev] How to update class parameters through API in Puppet Foreman?

I would like to be able to update the class parameters for a specific host
through the foreman api. I can’t seem to find a way to do this despite
hours of google searching and trial/error.

For example, in the screenshot attached I’d like to update
"clinical_findings" version to something other than “latest”.


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.