Bug #37740
openSmart proxies can serve incorrect content if remote is nil
Description
Description:
Foreman 3.11.1
Katello 4.13.0
Smart proxies in remote datacenters
Repositories on the main foreman server and all smart proxies are set to download content "On Demand"
It seems when a smart proxy doesn't have a remote set for a repository (eg. the data that should point to the main foreman server), it will serve a different repositories content (I'm assuming the previous repository in the list that does have a remote set). There's no warning this is happening and could be really bad depending on which repository is being served.
I've verified the remote isn't set as this returns nil when run in the console for the specific repository/smart proxy
smartproxy=SmartProxy::find(4)
Katello::Repository.find(300).backend_service(smartproxy).with_mirror_adapter.fetch_remote
Syncing the repo to the smart proxy fixes the issue
hammer -u <USER> -p <PASS> capsule content synchronize --id 4 --repository-id=300
What should happen:
An error should occur (minimally a 404 should be returned)
What actually happens:
A different repositories content is served. The incorrect content is visible both when browsing in the web browser and also when using yum/apt.