Other relevant data:
The following article said it was “Fixed In Version: tfm-rubygem-hammer_cli_foreman-0.17.0.6-1”
I upgraded to tfm-rubygem-hammer_cli_foreman-0.17.2-1.el7.noarch, but still get the same error.
logs
2019-08-22T15:34:41 [I|app|da69d322] Couldn't find Host::Managed with 'id'=69 [WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."organization_id" = $1 AND "hosts"."location_id" = $2 AND "taxonomies"."type" IN ('Location') AND ("taxonomies"."id" = 3 OR "taxonomies"."title" = '3')] (ActiveRecord::RecordNotFound)
The host is migrated from another katello system. And “hammer host info --id 69” does display information, and “hammer host list” also displays this host.
As that bug report is for Satellite the version refers to the hammer package in Satellite repos. Patched version of hammer CLI 0.17.x was not released yet in the Foreman repos.
If you can’t wait you can try to update to hammer 0.18 rpms from the 1.23 repos just be aware it is not tested and you may need to update also some hammer plugin rpms such as hammer-cli-katello. Another option would be to temporarily install hammer 0.18 from gems or from github checkout (note it needs to be neither same machine nor root user so you can have isolated vm for that). There are some hints in hammer-cli/doc/installation.md at master · theforeman/hammer-cli · GitHub.
Thanks for the suggestions. I used the option of installing the gem on another system.
$ hammer --version
hammer (0.18.0)
hammer_cli_foreman (0.18.0)
hammer_cli_katello (0.19.0)
However, I’m still receiving the error:
Could not update the host:
Resource host not found by id ‘69’
Couldn’t find Host::Managed with ‘id’=69 [WHERE “hosts”.“type” IN (‘Host::Managed’) AND “hosts”.“organization_id” = $1 AND “hosts”.“location_id” = $2 AND “taxonomies”.“type” IN (‘Location’) AND (“taxonomies”.“id” = 3 OR “taxonomies”.“title” = ‘3’)] (ActiveRecord::RecordNotFound)
Is it possible that there is another issue involved with changing subscriptions to a different katello systems?
Here the --location and --organization set the scope in which the update is performed. In hammer >= 0.18.0 there should be new option --new-organization and --new-location that should serve to update those fields. What you probably need is: hammer host update --name test.example.com --new-location “site a” --new-organization orgname