Unable to change host's ContentView and Lifecyckle Environment using hammer and API

Changing host’s ContentView and Lifecycle Environment is not working via hammer and API.
Neither warning nor error message is displayed. Values remain unchanged.
Problem may be related to previous issue (introduced by multi CV) :

Expected outcome:
Host’s ContentView or Lifecycle Environment will be successfully updated using hammer and API.

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:
RHEL 8.8

Other relevant data:

Examples of commands which are not working as expcted.

$ hammer host update --organization <org> --name <fqdn> --lifecycle-environment “DEV”
Host updated.
$ hammer host update --organization <org> --name <fqdn> --lifecycle-environment-id 2
Host updated.

Following API call changes “comment” but not Lifecycle Environment:
curl -u <user> --header “Accept:application/json” --header “Content-Type:application/json” --request PUT --data @lifecycle_env.json https://<katello_host>/api/v2/hosts/<content_host>

$ cat lifecycle_env.json
“content_facet_attributes”: {
“lifecycle_environment_id”: 2
“comment”: “Hello”

This should be fixed via Bug #36667: Hammer accepts non-existent LCE in host update - Katello - Foreman

It will be in Katello 4.10. I also proposed it to the upcoming release 4.9.2.

As a workaround, ensure that you pass both a content view and lifecycle environment.

Thank you at least for workaround. Both params provided at once works.

1 Like