Problem: in Foreman few of the host’s hostgroup update failed via api/hammer. While try to update via api/hammer getting the error “Name has already been taken error”, but there is no duplicate entry found in foreman.
Expected outcome: foreman api / hammer should update the hostgroup for hosts.
Foreman and Proxy versions: Foreman : 3.4.0-rc1, Proxy: 3.4.0~rc1-1
Foreman and Proxy plugin versions:
Distribution and version: Debian 11 (bullseye )
Other relevant data:
[ INFO 2022-08-25T01:51:03 HammerCLIForeman::Host::UpdateCommand] Called with options: {“option_volume_list”=>, “option_interface_list”=>, “option_id”=>852, “option_name”=>“10.200.70.81”, “option_hostgroup_title”=>“Test”, “option_hostgroup_id”=>408}
{“name”=>“10.200.70.81”, “hostgroup_id”=>408, “puppet_attributes”=>{}}
[DEBUG 2022-08-25T01:51:03 HammerCLIForeman::CommandExtensions::UpdateCommon] Called block for HammerCLIForeman::UpdateCommand request params:
#<Proc:0x00005631a99d3038 /usr/lib/ruby/vendor_ruby/hammer_cli_foreman/command_extensions/update_common.rb:8>
[DEBUG 2022-08-25T01:51:03 HammerCLIForemanPuppet::CommandExtensions::HostPuppetProxy] Called block for HammerCLIForeman::Host::UpdateCommand request params:
#<Proc:0x00005631aa0abdd8 /usr/lib/ruby/vendor_ruby/hammer_cli_foreman_puppet/command_extensions/host.rb:37>
[ INFO 2022-08-25T01:51:03 API] Server: https://foreman.example.com
[ INFO 2022-08-25T01:51:03 API] PUT /api/hosts/852
[DEBUG 2022-08-25T01:51:03 API] Params: {
“host” => {
“name” => “10.200.70.81”,
“hostgroup_id” => 408,
“puppet_attributes” => {}
}
}
[DEBUG 2022-08-25T01:51:03 API] Headers: {}
[DEBUG 2022-08-25T01:51:03 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2022-08-25T01:51:03 API] 422 Unprocessable Entity
[DEBUG 2022-08-25T01:51:03 API] {
“error” => {
“id” => 852,
“errors” => {
“name” => [
[0] “has already been taken”
]
},
“full_messages” => [
[0] “Name has already been taken”
]
}
}
[DEBUG 2022-08-25T01:51:03 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_unprocessable_entity
[ERROR 2022-08-25T01:51:03 Exception] Name has already been taken
Could not update the host:
Name has already been taken