Bug 2272520

Summary: Hammer host update false positive when excluding lifecycle environment
Product: Red Hat Satellite Reporter: Taft Sanders <tasander>
Component: Hosts - ContentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.14.3CC: ahumbe, iballou, ofedoren, rlavi
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged, UserExperience
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 17:27:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Taft Sanders 2024-04-01 17:58:35 UTC
Description of problem:
When updating a host's content view assignment without including a lifecycle environment value produces a false positive leading a user to believe the update was successful.

Version-Release number of selected component (if applicable):
rubygem-hammer_cli_foreman-3.7.0-1.el8sat.noarch
rubygem-hammer_cli_foreman_discovery-1.1.0-1.el8sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.19-1.el8sat.noarch
rubygem-hammer_cli_foreman_google-1.0.1-1.el8sat.noarch
rubygem-hammer_cli_foreman_admin-1.1.0-1.el8sat.noarch
rubygem-hammer_cli_katello-1.9.1.3-1.el8sat.noarch
rubygem-hammer_cli_foreman_remote_execution-0.2.3-1.el8sat.noarch
rubygem-hammer_cli_foreman_azure_rm-0.2.2-1.el8sat.noarch
rubygem-hammer_cli_foreman_openscap-0.1.13-2.el8sat.noarch
rubygem-hammer_cli-3.7.0.1-1.el8sat.noarch
rubygem-hammer_cli_foreman_ansible-0.5.0-1.el8sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.3.0-3.el8sat.noarch
rubygem-hammer_cli_foreman_templates-0.2.0-3.el8sat.noarch
rubygem-hammer_cli_foreman_webhooks-0.0.4-1.el8sat.noarch
rubygem-hammer_cli_foreman_virt_who_configure-0.0.9-2.el8sat.noarch


How reproducible:
Every time

Steps to Reproduce:
1. Using a satellite with a registered client and content view created
2. Use the command 'hammer host update --id <HOST ID> --content-view "<CONTENT VIEW>"' to update the content view of the host.
3. Check the content view assignment of the host

Actual results:
Host content view assignment remains unchanged and hammer command produces "Host updated"
[root@bombsat614 ~]# hammer host info --id 4
Id:                       4
Name:                     drone79.usersys.redhat.com
Organization:             Default Organization
--snip--
Content Information:      
    Content view environments: 
     1) Content view:          
            Id:        1
            Name:      Default Organization View
            Composite: no
        Lifecycle environment: 
            Id:   1
            Name: Library
--snip--


[root@bombsat614 ~]# hammer host update --id 4 --content-view test-small --organization-id 1
Host updated.


[root@bombsat614 ~]# hammer host info --id 4
Id:                       4
Name:                     drone79.usersys.redhat.com
Organization:             Default Organization
--snip--
Content Information:      
    Content view environments: 
     1) Content view:          
            Id:        1
            Name:      Default Organization View
            Composite: no
        Lifecycle environment: 
            Id:   1
            Name: Library
--snip--


Expected results:
Hammer command should fail with an error message notifying the user that the "--lifecycle-environment[-id]" is required to change the content view of the client.

Additional info:
seen from the production.log
2024-04-01T13:48:15 [I|app|006365b9] Started PUT "/api/hosts/4" for 10.13.226.224 at 2024-04-01 13:48:15 -0400
2024-04-01T13:48:15 [I|app|006365b9] Processing by Api::V2::HostsController#update as JSON
2024-04-01T13:48:15 [I|app|006365b9]   Parameters: {"organization_id"=>1, "host"=>{"content_facet_attributes"=>{"content_view_id"=>2}, "subscription_facet_attributes"=>{}}, "apiv"=>"v2", "id"=>"4"}
2024-04-01T13:48:15 [I|app|006365b9] Authorized user admin(Admin User)

[HERE]
2024-04-01T13:48:15 [I|app|006365b9] set_up_content_view_environment: cv_id=2, env_id=


2024-04-01T13:48:15 [I|app|006365b9] ForemanWebhooks::EventSubscriber: host_updated.event.foreman event received
2024-04-01T13:48:15 [I|app|006365b9]   Rendered api/v2/hosts/update.json.rabl (Duration: 206.3ms | Allocations: 58080)
2024-04-01T13:48:15 [I|app|006365b9] Completed 200 OK in 462ms (Views: 187.3ms | ActiveRecord: 73.5ms | Allocations: 81245)

Comment 1 Eric Helms 2024-06-06 17:27:23 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.