Bug #36167
openHammer update wipes out environment
Description
Description:
When I update hostgroup-title, environment gets wiped out. Without modifying the hostgroup-title the update behaves as expected.
How reproducible:
Consistently
Steps to Reproduce:
hammer host update --name hostXX.domainYY --build yes --operatingsystem "RHEL 8.7" --medium "RHEL Generic" --hostgroup-title "aaa/bbb/ccc"
Actual results:
Broken host update:
hammer host update --name hostXX.domainYY --build yes --operatingsystem "RHEL 8.7" --medium "RHEL Generic" --hostgroup-title "aaa/bbb/ccc"
Logs from foreman/production.log:
2023-03-06T13:39:26 [I|app|d3745c08] Parameters: {"host"=>{"name"=>"hostXX.domainYY", "operatingsystem_id"=>18, "medium_id"=>13, "hostgroup_id"=>108, "build"=>true, "puppet_attributes"=>{}}, "apiv"=>"v2", "id"=>"373"}
Working host update:
hammer host update --name hostXX.domainYY --build yes --operatingsystem "RHEL 8.7" --medium "RHEL Generic" --hostgroup-title "aaa/bbb/ccc" --environment cc8_tst
Logs from foreman/production.log:
2023-03-06T15:50:41 [I|app|91ca3168] Parameters: {"host"=>{"name"=>"hostXX.domainYY", "operatingsystem_id"=>18, "medium_id"=>13, "hostgroup_id"=>108, "build"=>true, "environment_id"=>1, "puppet_attributes"=>{"environment_id"=>1}}, "apiv"=>"v2", "id"=>"373"}
Expected result:
Change of hostgroup should not change environment
Additional info:
RHEL 8.6
Foreman 3.5.1
rubygem-hammer_cli 3.5.0
foreman_puppet 5.0.0
Files
Updated by Oleh Fedorenko almost 2 years ago
Hello, I can't reproduce the issue. Hammer works as expected for this command.
The only way how would be host's environment changed by this command is that the hostgroup you use doesn't have any Puppet environment assigned. In this case host's attributes will be updated to match the assigned hostgroup removing directly selected environment.
Could you confirm this?
Updated by Antonin Dvorak over 1 year ago
- File end_config.png end_config.png added
- File end_hostgroup.png end_hostgroup.png added
- File start_config.png start_config.png added
- File start_hostgroup.png start_hostgroup.png added
Hello,
I confirm that hostgroups have Puppet environment assigned.
Starting point:
Starting hostgroup config:
Hostgroup that will be assigned by hammer update config:
CMD:
hammer host update --name kvm-s3562-1-ip151-77.xxx --hostgroup-title rhel8/rhel86
Result (the environment attribute is gone: