Bug 2009049

Summary: pulp_rpm: Basic-auth repository causing invalid upstream url
Product: Red Hat Satellite Reporter: Grant Gainey <ggainey>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Sam Bible <sbible>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.0CC: chiggins, ggainey, gsulliva, gtalreja, jsherril, pcreech, rchan, satellite6-bugs, swadeley, ttereshc
Target Milestone: 6.11.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2007655 Environment:
Last Closed: 2022-07-05 14:30:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Grant Gainey 2021-09-29 18:54:00 UTC
+++ This bug was initially created as a clone of Bug #2007655 +++

Description of problem:
We are running a test that uses this repository: https://rplevka.fedorapeople.org/fakerepo01/. In our testing, we pass the username and password like https://<username>:<password>@rplevka.fedorapeople.org/fakerepo01/. This works fine in Satellite 6.9 when creating and syncing the repo, but in 6.10 you can't make the repo with this url in the UI. We are able to make the repo through the API, but when you get to syncing it fails due to the url**.


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


How reproducible:
Always

Steps to Reproduce:
1. Go to Content > Products > Create Product
2. Save the Product then New Repository
3. Create a Yum repo with the Upstream URL as https://<username>:<password>@rplevka.fedorapeople.org/fakerepo01/

Actual results:
bad URI(is not URI?): "https://<username>:<password>@rplevka.fedorapeople.org/fakerepo01/"

Expected results:
Repository is created successfully.

Additional info:

**Here's the error when you try to sync after making the repo through the API:

{"pulp_tasks"=>
  [{"pulp_href"=>"/pulp/api/v3/tasks/cfd5cca2-9093-401b-aca4-a1a9e33f2aba/",
    "pulp_created"=>"2021-09-24T13:48:32.853+00:00",
    "state"=>"failed",
    "name"=>"pulp_rpm.app.tasks.synchronizing.synchronize",
    "logging_cid"=>"5c1a697f-3ca5-4ab0-b8ae-4b354d95f17c",
    "started_at"=>"2021-09-24T13:48:32.929+00:00",
    "finished_at"=>"2021-09-24T13:48:32.984+00:00",
    "error"=>
     {"traceback"=>
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/tasking/pulpcore_worker.py\", line 272, in _perform_task\n" +
       "    result = func(*args, **kwargs)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 411, in synchronize\n" +
       "    remote_url = fetch_remote_url(remote)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 274, in fetch_remote_url\n" +
       "    get_repomd_file(remote, normalized_remote_url)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 232, in get_repomd_file\n" +
       "    return downloader.fetch()\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/download/base.py\", line 176, in fetch\n" +
       "    return done.pop().result()\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/download/http.py\", line 258, in run\n" +
       "    return await download_wrapper()\n" +
       "  File \"/usr/lib/python3.6/site-packages/backoff/_async.py\", line 133, in retry\n" +
       "    ret = await target(*args, **kwargs)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/download/http.py\", line 256, in download_wrapper\n" +
       "    return await self._run(extra_data=extra_data)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/downloaders.py\", line 95, in _run\n" +
       "    url, proxy=self.proxy, proxy_auth=self.proxy_auth, auth=self.auth\n" +
       "  File \"/usr/lib64/python3.6/site-packages/aiohttp/client.py\", line 1117, in __aenter__\n" +
       "    self._resp = await self._coro\n" +
       "  File \"/usr/lib64/python3.6/site-packages/aiohttp/client.py\", line 406, in _request\n" +
       "    raise InvalidURL(str_or_url) from e\n",
      "description"=>
       "http://<username>:<password>%40rplevka.fedorapeople.org/fakerepo01/repodata/repomd.xml"},
    "worker"=>"/pulp/api/v3/workers/51345666-6545-440a-a334-e24abe830a2b/",
    "child_tasks"=>[],
    "progress_reports"=>[],
    "created_resources"=>[],
    "reserved_resources_record"=>
     ["/pulp/api/v3/repositories/rpm/rpm/ee0f91e1-8a01-4f5d-bf2d-820102aa849c/",
      "/pulp/api/v3/remotes/rpm/rpm/07b34092-7492-43dc-8c1e-454d4de58014/"]}],
 "create_version"=>true,
 "task_groups"=>[]}

Comment 4 pulp-infra@redhat.com 2021-09-30 22:08:01 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 5 pulp-infra@redhat.com 2021-09-30 22:08:02 UTC
The Pulp upstream bug priority is at High. Updating the external tracker on this bug.

Comment 6 Grant Gainey 2021-10-04 13:57:32 UTC
This BZ isn't dependent on 2007655, pretty sure that was just an artifact of the bz-clone. 

Just as explanation - '7655 and the related upstream issue/epic are left to deal with the work to address this at remote-creation-time (notice basic-auth in url, split it out and store in appropriate db fields, migrate existing URLs correctly). This BZ was addressed to fix the regression quickly.

Comment 10 Sam Bible 2022-01-06 19:40:05 UTC
Verified in Satellite 7.0.0 Snap 3

Creating a Repo with username and password in the URL causes error.

Steps to Reproduce:
1. Go to Content > Products > Create Product
2. Save the Product then New Repository
3. Create a Yum repo with the Upstream URL as https://<username>:<password>@rplevka.fedorapeople.org/fakerepo01/

Expected results:
Repository is created successfully.

Actual results:
Satellite denies creation of the repo and points the user to use the upstream username and upstream password fields.

Based on upstream issues, this is what should be expected.

Comment 13 errata-xmlrpc 2022-07-05 14:30:00 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 (Moderate: Satellite 6.11 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:5498