Bug 2046195

Summary: Katello::Errors::Pulp3Error: Treeinfo file should have INI format
Product: Red Hat Satellite Reporter: Ganesh Payelkar <gpayelka>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.1CC: ggainey, kkinge
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: 2022-01-28 14:42:10 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 Ganesh Payelkar 2022-01-26 11:30:17 UTC
Description of problem:

Katello::Errors::Pulp3Error: Treeinfo file should have INI format

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

How reproducible:
New custom repos

Steps to Reproduce:
1. Create a custom product 
2. Add repo https://ltb-project.org/rpm/8/x86_64/
3. sync repo

Actual results:


{"pulp_tasks"=>
  [{"pulp_href"=>"/pulp/api/v3/tasks/118b50e7-031f-4e3c-bc9c-3ad8d831fb97/",
    "pulp_created"=>"2022-01-26T10:18:02.902+00:00",
    "state"=>"failed",
    "name"=>"pulp_rpm.app.tasks.synchronizing.synchronize",
    "logging_cid"=>"fb757003-3e50-463c-9ea1-764491203413",
    "started_at"=>"2022-01-26T10:18:03.006+00:00",
    "finished_at"=>"2022-01-26T10:18:08.227+00:00",
    "error"=>
     {"traceback"=>
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/tasking/pulpcore_worker.py\", line 317, in _perform_task\n" +
       "    result = func(*args, **kwargs)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 434, in synchronize\n" +
       "    treeinfo = get_treeinfo_data(remote, remote_url)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 397, in get_treeinfo_data\n" +
       "    treeinfo.load(f=result.path)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/kickstart/treeinfo.py\", line 27, in load\n" +
       "    raise TypeError(_(\"Treeinfo file should have INI format\"))\n",
      "description"=>"Treeinfo file should have INI format"},
    "worker"=>"/pulp/api/v3/workers/1764cd61-93c6-4ff8-a185-55ee536ba24a/",
    "child_tasks"=>[],
    "progress_reports"=>[],
    "created_resources"=>[],
    "reserved_resources_record"=>
     ["/pulp/api/v3/repositories/rpm/rpm/dede12fd-a960-4df2-a3f2-164036dbaf10/",
      "/pulp/api/v3/remotes/rpm/rpm/2a85625b-174a-4d2a-879b-e4db42471cf5/"]}],
 "create_version"=>true,
 "task_groups"=>[],
 "poll_attempts"=>{"total"=>7, "failed"=>1}}


Expected results:


Additional info:

Comment 1 Grant Gainey 2022-01-28 14:42:10 UTC
The only way for Pulp to know there's a .treeinfo file in a repo, is to look for it (make a GET request for (url)/.treeinfo or (url)/treeinfo). If there isn't one, the remote server responds with a 404, and pulp continues on its way.

ltb-project.org is misconfigured. If you ask it for something that doesn't exist, rather than responding with a 404 (per the HTTP spec), it redirects you to the home-page with a "302 Found", which hands pulp back an HTML page.

"302 Found" is to be used when "the target resource exists but has been moved" - https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3  Asking for a nonexistent resource must NEVER be "found".

"404" "indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists" - https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4


There isn't much Pulp can do when the remoter server lies about what it's handing back.