Description of problem: I want to create and update hosts using hammer host create/update and pass custom parameters to it. This works fine on create but fails when I want to update a host and pass a parameter that is already present. Version-Release number of selected component (if applicable): Satellite 6.1.3 How reproducible: always Steps to Reproduce: 1. hammer host create ... --parameters="foo=bar" 2. hammer host update ... --parameters="foo=bar" Actual results: Could not update the host: Name has already been taken Expected results: Host updated Additional info: It does not matter if I want to set the parameter to the same or a new value.
- Changes vias satellite GUI seems to work - If one needs to stay on the hammer tool, one might also be able to delete and then create with new parameters - The issue is seen on Satellite 6.1.1 codebase, as well as on current 6.1.3
This can be reproduced on upstream Foreman 1.9.0 too.
A proper workaround is to use "hammer host create/update" without --parameters and call "hammer host set-parameter" afterwards. This is however slightly silly, as one needs multiple calls to update multiple parameters.
Created redmine issue http://projects.theforeman.org/issues/12294 from this bug
The correct way to update a parameter is to use hammer host delete-parameter and then set-parameter. Using hammer host update --parameters does not update certain parameters but all parameters, meaning it should delete all the host_parameters and then creates only those you pass in the update. Example of expected behavior: hammer host info --id 1 Id: 1 ... Parameters: abc => d example => test hammer host update --id 1 --parameters "foo=bar" hammer host info --id 1 Id: 1 ... Parameters: foo => bar This is common in the api and hammer (look at hammer hostgroup update --organizations for example). So the correct way is to use --parameters for the initial setup of parameters and from then on use set/delete-parameter. I am leaving this bug open because the error should not appear, it should delete and add no matter what the original parameters were. Please note if you are not updating all the parameters you will delete those you don't send.
Ack, I think the overwrite of ALL params is expected. But I also think this should be clearly stated in the help output for hammer host update (and probably also point to the hammer host {create/delete/set}-parameter alternative?)
Upstream bug assigned to oprazak
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/12294 has been resolved.
Issue is addressed in satellite 6.3 beta snap9. Tested and verified. Please find the attached screenshot for verification
Created attachment 1308725 [details] host update param value for existing param
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-2018:0336
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-2018:0336