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

Currently tested on katello-4.9.2-1.el8.noarch
ContentView can’t be changed individually: “Could not update the host: Lifecycle environment must be specified”
Lifecycle Environment can’t be changed individually: “Could not update the host: Content view must be specified”

You do have to specify both now – this is by design. Content views and lifecycle environments are now assigned as a single unit, not separately. If you want to change only the CV, just specify the same LCE, and vice versa.