Bug 1944710 - Should not be able to assign LE on the client profile which is not synced on the capsule server
Summary: Should not be able to assign LE on the client profile which is not synced on ...
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.8.0
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: 6.14.0
Assignee: Jeremy Lenz
QA Contact: Vladimír Sedmík
URL:
Whiteboard:
: 2134087 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-30 14:18 UTC by rakesh kumar
Modified: 2023-06-29 20:12 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2218657 (view as bug list)
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36316 0 High Closed Should not be able to assign LE on the client profile which is not synced on the capsule server 2023-05-17 13:05:24 UTC
Red Hat Issue Tracker SAT-16642 0 None None None 2023-06-07 05:15:45 UTC
Red Hat Knowledge Base (Solution) 7019752 0 None None None 2023-06-16 17:33:06 UTC

Description rakesh kumar 2021-03-30 14:18:54 UTC
Description of problem:

Let say, the satellite has 2 lifecycle environment 'Development' and 'Testing', only Development LE is assigned and synced to the capsule. After registering a client through the capsule, I can assign 'Testing' LE to the client system in the content host profile. After that, 'yum repolist' fails with 404 error like below:

~~~~~~~~~~~~~~~
[root@client ~]# yum repolist
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
https://capsule.example.com/pulp/repos/RedHat/Development/demo/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

https://capsule.example.com/pulp/repos/RedHat/Development/demo/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
repo id                                                                  repo name                                                                               status
rhel-7-server-rpms/x86_64                                                Red Hat Enterprise Linux 7 Server (RPMs)                                                0
repolist: 0
Uploading Enabled Repositories Report
Loaded plugins: product-id, subscription-manager
~~~~~~~~~

We should not be able to assign the LE to the client which is not synced on the capsule or we can have a show proper error message(like 'This LE is not synced on the capsule') when trying to assign LE which is not synced on the capsule.

Version-Release number of selected component (if applicable):
Satellite 6.x

How reproducible:
Always

Steps to Reproduce:
1. Register a client through a capsule
2. Go to client profile in content host page, assign a LE which is not synced on the capsule and select a content view in that LE 
3. Execute below command on the client:
 # subscription-manager refresh
 # yum clean all; yum repolist

Comment 4 Jeremy Lenz 2023-03-16 20:48:52 UTC
We should update the host content view selector to require selection in order:

1. Content source (capsule)
2. LCE
3. Content view

In 6.13 the 'Change Content Source' page already does this. This would just be a matter of updating the 'Edit content view assignment' modal on the content view overview card.

Comment 5 Jeremy Lenz 2023-03-17 15:45:45 UTC
In addition, the LCE and Content view selection should be limited based on what environment is assigned to the selected content source.

Comment 6 Jeremy Lenz 2023-03-17 15:46:47 UTC
*** Bug 2134087 has been marked as a duplicate of this bug. ***

Comment 7 Jeremy Lenz 2023-04-18 20:10:43 UTC
Created redmine issue https://projects.theforeman.org/issues/36316 from this bug

Comment 8 Bryan Kearney 2023-04-19 16:01:46 UTC
Upstream bug assigned to jlenz

Comment 9 Bryan Kearney 2023-04-19 16:01:49 UTC
Upstream bug assigned to jlenz

Comment 11 Bryan Kearney 2023-05-17 16:01:41 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36316 has been resolved.

Comment 12 Ian Ballou 2023-06-06 15:03:48 UTC
This is a defect and not an RFE, so I'm removing the RFE bits.

Comment 18 Vladimír Sedmík 2023-06-29 20:12:47 UTC
Verified in 6.14.0 snap 4

Setup as per comment 0:
1) SAT with multiple organizations and LCEs and CVs in each organization
2) CAPS with only a subset of LCEs and a host registered through it

Results:
1) On Host details page -> Change content source page (through top right kebab), as well as on
2) On Host details page -> Overview tab -> Content view details card -> Edit content view assignment modal:
   - Message that some LCEs were disabled because they are not associated with the host's content source is displayed
   - Only the LCEs associated with the content source can be selected
   - Only CVs inside the selected LCE can be selected
3) On the 'Create Host' page
   - The 'Lifecycle Environment' dropdown is scoped to the selected organization (contains only the organization's LCEs).
4) Attempts to assign LCE not synced on the content source through CLI/API returns appropriate error:
[ERROR 2023-06-29T14:14:20 API] 500 Internal Server Error
[DEBUG 2023-06-29T14:14:20 API] {
    "error" => {
        "message" => "Validation failed: Host rhel8host.redhat.com: Cannot add content view environment to content facet. The host's content source 'capsule.redhat.com' does not sync lifecycle environment 'OWCA-2'."
    }
}
5) Content host page -> bulk action still allows to assign any LCE to the selected host. However, the assignment fails with error and the issue will be tracked by BZ#2218528


Note You need to log in before you can comment on or make changes to this bug.