Project

General

Profile

Actions

Bug #36167

open

Hammer update wipes out environment

Added by Antonin Dvorak almost 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

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

end_config.png View end_config.png 17.2 KB Antonin Dvorak, 04/12/2023 07:43 AM
end_hostgroup.png View end_hostgroup.png 23.7 KB Antonin Dvorak, 04/12/2023 07:43 AM
start_config.png View start_config.png 18.8 KB Antonin Dvorak, 04/12/2023 07:43 AM
start_hostgroup.png View start_hostgroup.png 16.2 KB Antonin Dvorak, 04/12/2023 07:43 AM
Actions #1

Updated by Antonin Dvorak almost 2 years ago

  • Description updated (diff)
Actions #2

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

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:

Actions

Also available in: Atom PDF