Bug 1815440

Summary: Syncing repository with upstream URL "https://elrepo.org/linux/elrepo/el7/x86_64/" gives "406: Not Acceptable" error on Red Hat Satellite 6
Product: Red Hat Satellite Reporter: Naina Jain <naijain>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Bruno Rocha <rochacbruno>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: ajb, casl, gertjan.bijl, jkrajice, phil, swadeley, toracat, ttereshc
Target Milestone: UnspecifiedKeywords: Triaged
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: 2020-05-01 14:28:18 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 Naina Jain 2020-03-20 09:45:44 UTC
Description of problem:
Syncing repository with upstream URL "https://elrepo.org/linux/elrepo/el7/x86_64/" gives "406: Not Acceptable" error on Red Hat Satellite 6

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

How reproducible:
Always

Steps to Reproduce:
1. Navigate to Content --> Products --> Create a Product --> Create a Repository "ELrepo"

2. Set the Repository type "Yum Repositories"

3. Give upstream URL as "https://elrepo.org/linux/elrepo/el7/x86_64/" and save the repository.



Actual results:
Once the repository has been created, When you try to sync, It will show error "Error: RPM1004: Error retrieving metadata: Not Acceptable".


Expected results:
Expect successful synchronization of the repository.


Additional Logs:


Mar 18 08:42:16 satellite.example.com pulp[116607]: requests.packages.urllib3.connectionpool:INFO: [ffbf318d] Starting new HTTPS connection (1): elrepo.org
Mar 18 08:42:17 satellite.example.com pulp[116607]: nectar.downloaders.threaded:INFO: [ffbf318d] Download failed: Download of https://elrepo.org/linux/elrepo/el7/x86_64/ failed with code 406: Not Acceptable
Mar 18 08:42:17 satellite.example.com pulp[116607]: pulp_rpm.plugins.importers.yum.sync:INFO: [ffbf318d] Downloading metadata from https://elrepo.org/linux/elrepo/el7/x86_64/.
Mar 18 08:42:17 satellite.example.com pulp[116607]: requests.packages.urllib3.connectionpool:INFO: Starting new HTTPS connection (1): elrepo.org
Mar 18 08:42:17 satellite.example.com pulp[116607]: nectar.downloaders.threaded:INFO: Download failed: Download of https://elrepo.org/linux/elrepo/el7/x86_64/repodata/repomd.xml failed with code 406: Not Acceptable


Note:

The issue is reproducible on any version of Satellite. 

If we change the upstream URL to a mirror URL i.e. http://mirrors.coreix.net/elrepo/elrepo/el7/x86_64/"  then repo sync seems to work

Comment 3 Tanya Tereshchenko 2020-03-30 18:06:59 UTC
Naina, could you retest please?

I tried today with the upstream pulp 2.21 and it works without any issue.
It's possible that it was something with this mirror and they fixed it.

Comment 4 Charles Slivkoff 2020-04-07 13:34:04 UTC
I opened the support case to report this issue.  It is still a problem.

From syslog:

Apr 07 09:25:00 *******.cmu.edu pulp[121266]: nectar.downloaders.threaded:INFO: Download failed: Down
load of https://elrepo.org/linux/elrepo/el8/x86_64/repodata/repomd.xml failed with code 406: Not Acceptable

Comment 5 Akemi Yagi 2020-04-30 16:35:05 UTC
A bug report has been filed with ELRepo:

https://elrepo.org/bugs/view.php?id=1006

Comment 6 Gertjan Bijl 2020-04-30 19:05:04 UTC
As also mentioned in the ElRepo bug-report:

I debugged some more on our side, and I found the issue: the server is not accepting the User-Agent. Was able to reproduce with cURL from command-line:

$ curl -I -H "Accept: */*" -H "Accept-Encoding: gzip, deflate" -H "User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-1062.18.1.el7.x86_64" https://elrepo.org/linux/testing/el8/x86_64/repodata/repomd.xml [^]

HTTP/1.1 406 Not Acceptable
Date: Thu, 30 Apr 2020 18:46:45 GMT
Server: Apache
Content-Type: text/html; charset=iso-8859-1

With 'curl' as User-Agent it works as it should.
$ curl -I -H "Accept: */*" -H "Accept-Encoding: gzip, deflate" -H "User-Agent: curl" https://elrepo.org/linux/testing/el8/x86_64/repodata/repomd.xml [^]
HTTP/1.1 200 OK
Date: Thu, 30 Apr 2020 18:46:53 GMT
Server: Apache
Upgrade: h2,h2c
Connection: Upgrade
Last-Modified: Thu, 30 Apr 2020 18:01:02 GMT
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 961
Content-Type: application/xml

Unfortunately I cannot change the User-Agent of the Satellite-process, but I'm pretty sure the server should just accept this as User-Agent, as it is basically just a string.

Comment 7 Tanya Tereshchenko 2020-05-01 14:28:18 UTC
Thanks for investigation. It seems like a problem with elrepo as suspected.
Closing as not a bug.