Hide Forgot
Similiar to #15003 around using Hammer to remove smart-class param overrides to hosts. Currently there is a trivial API call to add an override by FQDN for a specific host - this is very useful for us; <pre> -X POST --/api/v2/puppetclasses/:puppetclass_name/smart_class_parameters/:parameter_name/override_values -d '{"match":"fqdn=:hostname","value":":parameter_value}"}}' </pre> e.g <pre> --/api/v2/puppetclasses/apache::vhost/smart_class_parameters/port/override_values -d '{"match":"fqdn=myhost1","value":"4055"}}' </pre> this is really nice and clean way of assigning values to hosts on a single basis, particularly when interfacing with external systems. However when it comes to changing or removing this override, the calls are more elaborate, as you need to know both the specific numeric ID of the parameter, as well as the numeric ID of the *override itself*. e.g <pre> -X PUT --/api/v2/smart_class_parameters/412/override_values/1021 -d '{"override_value":{"match":"fqdn=myhost1","value":"4056"}}' -X DELETE --/api/v2/smart_class_parameters/412/override_values/1021 </pre> This means external systems need to cache a list potentially of *all* override ids, parse and choose the related one. Hence I would like to be able to edit using the same call as adding an override, or equivalent functionality for delete, eg. <pre> -X PUT --/api/v2/puppetclasses/apache::vhost/smart_class_parameters/port/override_values -d '{"match":"fqdn=host1","value":"4057"}}' </pre>
Created from redmine issue https://projects.theforeman.org/issues/22090
Upstream bug assigned to None
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/22090 has been resolved.
Hi Marek, I am trying to verify this bug but it seems to be not working. The DEV is from the community and hence I am not getting the help required. I tried : (Update override, without override parameter id) curl -u admin:changeme -X PUT -d '{"match":"os=RedHat 7.6","value":"overriden_hogaye_firse"}' --header "Content-Type:application/json" https://qeblade36.rhq.lab.eng.bos.redhat.com/api/v2/puppetclasses/1/smart_class_parameters/41/override_values I am getting error : Wrong URL to PUT to. Again I tried, (sc-param name instead of id) curl -u admin:changeme -X PUT -d '{"match":"os=RedHat 7.6","value":"overriden_hogaye_firse"}' --header "Content-Type:application/json" https://qeblade36.rhq.lab.eng.bos.redhat.com/api/v2/puppetclasses/1/smart_class_parameters/content/override_values Still, I am getting the same error, the Wrong URL to PUT to. What am I doing wrong? Need Help
replied via email meanwhile, the change is that matcher can be used instead of override id, please see the email for an example
FailedQA! Steps: 1. Attempt to update the override value by PUTing on satellite with overrides matcher instead of its id. e.g: # curl -u admin:changeme -X PUT -d '{"value":"overridened3"}' --header "Content-Type:application/json" "https://qeblade36.rhq.lab.eng.bos.redhat.com/api/v2/puppetclasses/1/smart_class_parameters /3/override_values/os=rhel7.6" Observation and Logs: PUT request fails if the matcher attribute name has space or dot(.) character. # curl -X PUT -d '{"value":"overridened3"}' --header "Content-Type:application/json" "https://<server_url>/api/v2/puppetclasses/1/smart_class_parameters/3/override_values/os=rhel7.6" { "error": {"message":"Resource override_value not found by id 'os=rhel7'" } # curl -X PUT -d '{"value":"overridened3"}' --header "Content-Type:application/json" "https://<server_url>/api/v2/puppetclasses/1/smart_class_parameters/3/override_values/os=rhel 7" <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> </body></html>
Upstream bug assigned to orabin
Verified! @Satellite 6.5 snap 20 Steps and Observation: 1. With Dot(.) character: # curl -X PUT -d '{"value":"overridened"}' --header "Content-Type:application/json" "https://sat.url/api/v2/puppetclasses/1/smart_class_parameters/3/override_values/os=rhel7.6" {"created_at":"2019-03-18 10:05:47 UTC","updated_at":"2019-03-18 10:08:09 UTC","id":21,"match":"os=rhel7.6","value":"overridened","omit":false,"use_puppet_default":false} 2. With Space Character: # curl -X PUT -d '{"value":"overridened2"}' --header "Content-Type:application/json" https://sat.url/api/v2/puppetclasses/1/smart_class_parameters/3/override_values/os=rhel%207 {"created_at":"2019-03-18 10:05:47 UTC","updated_at":"2019-03-18 11:43:53 UTC","id":21,"match":"os=rhel 7","value":"overridened2","omit":false,"use_puppet_default":false} Verified!
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2019:1222