Bug 2124047

Summary: Accessing an external capsule from UI, shows "Last sync failed: 404 Not Found" even if the last capsule content sync was successful in Satellite 6.12
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: Capsule - ContentAssignee: Chris Roberts <chrobert>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.12.0CC: chrobert, pcreech
Target Milestone: 6.12.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
URL: https://projects.theforeman.org/issues/35552
Whiteboard:
Fixed In Version: tfm-rubygem-katello-4.5.0.17-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:35:39 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:
Attachments:
Description Flags
UI error while accessing the capsule
none
Search query used to see the capsule related tasks by Satellite none

Description Sayan Das 2022-09-04 08:57:24 UTC
Description of problem:

Accessing an external capsule from UI, shows "Last sync failed: 404 Not Found" even if the last capsule content sync was successful.

But it does not seems like the error is related to Capsule sync but If the very last task related to that capsule [ lest say a REX job ] fails, then also It shows that error and It can give a very wrong impression to the customer. 

The type of search it does for the tasks is "resource_id = 2 AND resource_type = SmartProxy" which is fine but It lists not just the sync tasks but the REX jobs via that capsule as well.


Version-Release number of selected component (if applicable):

Satellite\Capsule 6.12


How reproducible:

Always


Steps to Reproduce:

1. Install A Satellite and External Capsule 6.12

2. Sync some content in satellite as well as capsule

3. Ensure that Ansible feature is not enabled in capsule ( which should be happening by default ).

4. Register a system with capsule via global registration method

5. Turn on the "Prefer registered through Capsule for remote execution" setting in Administer --> Settings --> Content tab of Satellite/

6. Run an Ansible-based job on the target server (ensuring that REX smart-proxy is selected as capsule) and let the job fail.

7. Come back to the Infrastructure --> Capsules page and click open the capsule.



Actual results:


In Step 7, 

* Top right corner of the UI will immediately show "Last sync failed: 404 Not Found"

* Under the Content Sync section, the progress bar will be red and halfway filled, giving the notion that Capsule may not have been properly synced.


Expected results:

The "Content Sync" segment or the Capsule sync status in Satellite UI , should only rely on the last successful\failed capsule sync task and It should not show the status based on the status of the last REX job executed on a target host via the capsule. 


Additional info:

Screenshots attached

Comment 1 Sayan Das 2022-09-04 08:58:04 UTC
Created attachment 1909458 [details]
UI error while accessing the capsule

Comment 2 Sayan Das 2022-09-04 08:58:49 UTC
Created attachment 1909459 [details]
Search query used to see the capsule related tasks by Satellite

Comment 4 Brad Buckingham 2022-09-07 14:28:27 UTC
Is this a regression from Satellite 6.11?

Comment 5 Sayan Das 2022-09-07 15:23:09 UTC
Yes. It is indeed.

On 6.11, No matter how hard I try to get the Ansible REX job executed via a capsule that does not have the ansible feature enabled, It will tell me this:

~~
Failed to initialize: RuntimeError - Could not use any Capsule for the Ansible job. Consider configuring remote_execution_global_proxy, remote_execution_fallback_proxy in settings
~~


And then the task will not even trigger.


For 6.12, The task will trigger via that bad capsule and raise the tracebacks as I had reported.

Comment 7 Vladimír Sedmík 2022-09-30 10:23:28 UTC
Reproduced in 6.12.0 snap 12, verified in 6.12.0 snap 13:
1) Had a Satellite, Capsule (with Ansible enabled) and a host registered through the Capsule.
2) Triggered an Ansible REX job, checked it run through the Capsule -> it succeeded.
3) Removed Capsule's key from the host's authorized_keys and rerun the job -> it failed, leaving a failed task related to the Capsule.
4) Checked the Capsule's page in WebUI -> no errors were displayed, no red bar.
5) Triggered a Capsule sync task and stopped the services on the Capsule side -> correct error was displayed.
6) Reloaded the Capsule page -> correct error was displayed for the last sync task (even after the services were restarted).

Comment 11 errata-xmlrpc 2022-11-16 13:35:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.12 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:8506