Hammer can't edit host

At some point hammer can’t edit a host, e.g. changing the puppet environment. This happens when a change of a host cannot be safed because parameters went missing.

A new minor release of Debian is available. The host is updated, puppet is running after the update and collects the new os version information. Foreman takes this information and itself updates the host with this new information.
When the new os version has not been configured by now in foreman, meaning configure partition table, bootloader and mirror, then these options will be unset at the host with the new os version.

Now the host can’t be edited anymore because you cannot save your changes without setting these options again. In the same way hammer now is also unable to edit a host.

We’re using hammer inside of Gitlab Pipelines to e.g. change a host back to our production environment and delete a merged branch from foreman. This stops working which ends in much manual work to clean up foreman and get it fixed.

Expected outcome:
When you’re in the host selection, mark a host and choose “change environment” then you’re able to change the puppet environment even when you can’t safe the changes made to a host. Hammer should behave the same way.

Foreman and Proxy versions:
Foreman and Proxy plugin versions:

Other relevant data:
I checked the release notes from foreman 1.20.2 to 1.23.0 but couldn’t find a note that is related to this issue.

Hi @daylicron,

I saw you’ve also created an issue[1]. Thanks for reporting it and also for debug output. Unfortunatelly, I’m afraid that it’s not hammer issue since in the output you can see
Could not update the host: Ip does not match selected subnet
The puppet environment should be changeable via hammer, but since hammer uses Foreman API and if something went wrong on the server side, hammer can’t do much about it.

[1] - Feature #28071: Let Hammer edit not storable hosts - Hammer CLI - Foreman

Hi @ofedoren,
so I’m going to move the issue to the api? Since you’re able to change the environment as described in the expected outcome section, I really would like to have this doable via the api.

Yes, it should probably be under API issues.

I thought it might be a problem related to hammer (we had a problem with changing puppet environments if hammer-cli-katello plugin was installed, see https://bugzilla.redhat.com/show_bug.cgi?id=1713222).

But from provided output I don’t see any problems related to hammer specifically.