Bug 769072

Summary: Should not leave space in yum repo names on export
Product: Red Hat Satellite Reporter: Jason Guiditta <jguiditt>
Component: APIAssignee: Lukas Zapletal <lzap>
Status: CLOSED WONTFIX QA Contact: Garik Khachikyan <gkhachik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: bkearney, gkhachik, hbrock, imcleod, jrd, mkoci, mmccune, sloranz
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-02 11:53:10 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:
Bug Depends On:    
Bug Blocks: 747354    
Attachments:
Description Flags
patch to remove spaces from name and include pulp_id none

Description Jason Guiditta 2011-12-19 20:46:27 UTC
Description of problem: 

When katello exports an image template for use in aeolus, the name of the yum repo sometimes has a space.  This causes yum to throw a 'bad id' error when trying to use this repo.  It seems it is acceptable to have no space, '-', or '_'.  I don't know if other characters are acceptable, but these 3 versions worked for me in general testing.  If katello could concatenate mult-word repo names in any of these 3 ways, it should alleviate the issue.

Comment 1 Mike McCune 2011-12-19 23:53:38 UTC
So to be clear you are saying this XML:


  <repositories>
    <repository name="Red Hat Enterprise Linux 6 Server RPMs 61 x86_64">
      <url>https://sat-perf-04.idm.lab.bos.redhat.com/pulp/repos/ACME_Corporation/Locker/content/dist/rhel/server/6/6.1/x86_64/os</url>
      <persisted>No</persisted>
    </repository>
    <repository name="Red Hat Enterprise Linux 6 Server - Optional RPMs 61 x86_64">
      <url>https://sat-perf-04.idm.lab.bos.redhat.com/pulp/repos/ACME_Corporation/Locker/content/dist/rhel/server/6/6.1/x86_64/optional/os</url>
      <persisted>No</persisted>
    </repository>
  </repositories>

should instead look like:

  <repositories>
    <repository name="Red_Hat_Enterprise_Linux_6_Server_RPMs_61_x86_64">
      <url>https://example.redhat.com/pulp/repos/ACME_Corporation/Locker/content/dist/rhel/server/6/6.1/x86_64/os</url>
      <persisted>No</persisted>
    </repository>
    <repository name="Red_Hat-Enterprise_Linux_6_Server_-_Optional_RPMs_61 x86_64">
      <url>https://example.redhat.com/pulp/repos/ACME_Corporation/Locker/content/dist/rhel/server/6/6.1/x86_64/optional/os</url>
      <persisted>No</persisted>
    </repository>
  </repositories>

or perhaps something similar?

could we instead add an 'id' field and keep the names human readable instead?  id could be something that is usable in yum's config:

<repository name="Red Hat Enterprise Linux 6 Server RPMs 61 x86_64" id="rhel-6-server-optional-rpms">

Comment 2 Mike McCune 2011-12-20 01:24:05 UTC
Created attachment 548727 [details]
patch to remove spaces from name and include pulp_id

Adding a patch that can be used to convert all spaces to underscores in the name in the XML.  Not sure if that is the right thing todo but will fix any short term issues.

Comment 3 Mike McCune 2011-12-20 01:25:37 UTC
Added a patch in comment 2 that adds converts the spaces to _ in the repo name field:


<repository name="repo_name_with_spaces_and_stuff" id="ACME_Corporation-Fedora-repo_name_with_spaces_and_stuff">
  <url>
https://el6.pdx.redhat.com/pulp/repos/ACME_Corporation/Locker/custom/Fedora/repo_name_with_spaces_and_stuff
  </url>
  <persisted>No</persisted>
</repository>

Comment 4 Hugh Brock 2011-12-20 12:16:39 UTC
Hello Mike. I should have commented on this earlier. Either solution you propose will work fine -- the only constraint is that Oz needs *something* to feed to Yum that doesn't have spaces in it. I'm not sure why Yum cares, but it does apparently.

If the better solution for you guys is to generate a separate ID field and keep the Name attribute fully human-readable, we can adjust Oz accordingly. For now we have patched Oz along exactly the lines you described above -- it replaces " " with "_" in the name field. So this patch *may* not even be needed.

One thing that does strike me as important is that the Yum repos following an Oz build should look the same as the Yum repos created by a Katello kickstart install for bare metal. Is there some logic that creates sane Yum repo names for that installation method?

Thanks...

Comment 6 jrd 2011-12-22 14:29:27 UTC
I'm not sufficiently familiar with the code to say for certain, but I believe oz does do stuff like you're suggesting.  Adding imcleod and sloranz, they may have better insight into that issue.

Comment 7 Hugh Brock 2011-12-22 14:42:11 UTC
The problem is not the repo name in the repo definition. The problem is the *filename* that Oz, via Anaconda, is giving the repo definition (which I believe should be, in this example, rhel-6-server-optional-rpms). Oz is pulling this from the "name" attribute in the template. This may well be wrong -- it may be that the filename should come from some other piece of data that we are not giving Oz at all. We hacked in a replace-spaces-with-underscores patch to Oz to work around this, but I'm completely unconvinced that is the right solution.

What do you guys do when you create repo definitions in kickstarts?

Comment 9 Bryan Kearney 2011-12-22 20:09:53 UTC
Sorry.. App Engine folks, can we include a <label> item under <repo>? It would be a peer for <URL>

Comment 10 Bryan Kearney 2012-01-03 14:24:22 UTC
To follow up, the resolution to this is to add a <label> tag under repo. It should be text which is acceptable for use as a yum repo label (e.g. no spaces).

App Engine will open a matching bug to handle this new element.

Comment 11 Jason Guiditta 2012-01-05 19:08:29 UTC
Maybe I misparsed the email from Chris Alfonso, but I believe he added code to Oz itself to make sure it removes spaces for the repo id, which seems to me to obviate the need for any of this other work.  Perhaps I am missing something.

Comment 12 Lukas Zapletal 2012-01-20 14:01:57 UTC
We definitely need another tag (<label> perhaps) to send the filename and repo_id along with the long name. Name and label are two different things, I dont thin we want filenames like that:

Red_Hat_Enterprise_Linux_6_Server_-_Optional_(RPMs).repo

Since this is our blocker bug, can you please implement this in Oz for us?

Comment 13 Ian McLeod 2012-01-20 14:49:00 UTC
Chris' one line fix for this is here:

https://github.com/aeolusproject/oz/commit/bf2e3e42e197e442df634e541626e2338982c0fd

It is also in the latest brew build of Oz.

Comment 14 Lukas Zapletal 2012-01-20 15:48:25 UTC
Thanks. Mike you did not push the patch you attached, do you? It is not necessary I guess now.

Comment 18 Lukas Zapletal 2012-03-02 11:53:10 UTC
Garik, there was no change on our side. It was changed on the Aeolus side.

Guys, we are able to deliver you nice "label" or something, that is shorter and much nicer than name with converted spaces. If you want this, just file another BZ for us (post V1 please). Thanks.