Bug 625922 - yum --releasever=14 update gives a unclear error message when repo is not available
Summary: yum --releasever=14 update gives a unclear error message when repo is not ava...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Seth Vidal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-20 19:47 UTC by Rahul Sundaram
Modified: 2014-01-21 23:16 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-02-17 13:33:58 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Rahul Sundaram 2010-08-20 19:47:00 UTC
Description of problem:


I tried upgrading from 13 to 14 using yum

$ sudo yum --releasever=14 update

Loaded plugins: presto, refresh-packagekit
updates/metalink                                        |  17 kB     00:01     
Could not parse metalink https://mirrors.fedoraproject.org/metalink?repo=updates-released-f14&arch=x86_64 error was 
File /var/cache/yum/x86_64/14/updates/metalink.xml.tmp is not XML
Error: Cannot retrieve repository metadata (repomd.xml) for repository: updates. Please verify its path and try again

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

yum-3.2.28-3.fc13.noarch

---

Talking to the Seth Vidal in #yum, I see that this error means that updates repo is not available but Seth agreed that this error message could be better and wanted me to file it here.

Comment 1 Rahul Sundaram 2010-08-20 20:26:27 UTC
So, this is not really a yum problem but mirror manager not returning valid metalink.  I think mirror manager could just redirect from updates repo to base repo. Copying mdomsch

Comment 2 James Antill 2010-08-20 21:41:47 UTC
Well there _is_ data it's just bad. For the above URL you currently get:

<?xml version="1.0" encoding="utf-8"?>
<!--
# repo = updates-released-f14 arch = x86_64 error: invalid repo or arch
# following repositories are available:
# repo=core-2, arch=i386
# repo=core-2, arch=x86_64
# repo=core-3, arch=i386
# repo=core-3, arch=x86_64
# repo=core-4, arch=i386
# repo=core-4, arch=ppc
# repo=core-4, arch=x86_64
[...]

# repo=updates-testing-source-f9.newkey, arch=source
# repo=updates-testing-source-fc6, arch=source

-->

...the problem is that isn't a valid XML document (no start tag). In theory if MM was changed to produce something like:


<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/" type="dynamic" pubdate="Fri, 20 Aug 2010 20:22:32 GMT" generator="mirrormanager" xmlns:mm0="http://fedorahosted.org/mirrormanager">

<!--
# repo = updates-released-f14 arch = x86_64 error: invalid repo or arch
[...]

-->

</metalink>

...we could maybe do something. Or, as Rahul says, MM could just make updates == updates-testing or a blank repo. or something.

Comment 3 Matt Domsch 2010-08-23 15:50:54 UTC
I added this patch to MM upstream (after 1.3.6 which is currently deployed).

commit aee20493d04f061e6b7733e808807326a455b076
Author: Matt Domsch <Matt_Domsch>
Date:   Mon Aug 23 10:48:02 2010 -0500

    mirrorlist_server: always output a metalink header

    reported in https://bugzilla.redhat.com/show_bug.cgi?id=625922

    the metalink failuredoc did not include the metalink header as would
    be required to be considered valid XML.

diff --git a/mirrorlist-server/mirrorlist_server.py b/mirrorlist-server/mirrorlist_server.py
index 9c85343..e366f33 100755
--- a/mirrorlist-server/mirrorlist_server.py
+++ b/mirrorlist-server/mirrorlist_server.py
@@ -91,15 +91,27 @@ def uniqueify(seq, idfun=None):
         result.append(item)
     return result

-
 ##### Metalink Support #####
-def metalink_failuredoc(message=None):
+
+def metalink_header():
+    # fixme add alternate format pubdate when specified
+    pubdate = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
     doc = ''
-    doc += '<?xml version="1.0" encoding="utf-8"?>\n'
+    doc += '<metalink version="3.0" xmlns="http://www.metalinker.org/"'
+    doc += ' type="dynamic"'
+    doc += ' pubdate="%s"' % pubdate
+    doc += ' generator="mirrormanager"'
+    doc += ' xmlns:mm0="http://fedorahosted.org/mirrormanager"'
+    doc += '>\n'
+    return doc
+
+def metalink_failuredoc(message=None):
+    doc = metalink_header()
     if message is not None:
         doc += '<!--\n'
         doc += message + '\n'
         doc += '-->\n'
+    doc += '</metalink>\n'
     return doc

 def metalink_file_not_found(directory, file):
@@ -108,8 +120,6 @@ def metalink_file_not_found(directory, file):

 def metalink(cache, directory, file, hosts_and_urls):
     preference = 100
-    # fixme add alternate format pubdate when specified
-    pubdate = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
     try:
         fdc = file_details_cache[directory]
         detailslist = fdc[file]
@@ -119,14 +129,7 @@ def metalink(cache, directory, file, hosts_and_urls):
     def indent(n):
         return ' ' * n * 2

-    doc = ''
-    doc += '<?xml version="1.0" encoding="utf-8"?>\n'
-    doc += '<metalink version="3.0" xmlns="http://www.metalinker.org/"'
-    doc += ' type="dynamic"'
-    doc += ' pubdate="%s"' % pubdate
-    doc += ' generator="mirrormanager"'
-    doc += ' xmlns:mm0="http://fedorahosted.org/mirrormanager"'
-    doc += '>\n'
+    doc = metalink_header()
     doc += indent(1) + '<files>\n'
     doc += indent(2) + '<file name="%s">\n' % (file)
     y = detailslist[0]

Comment 4 Matt Domsch 2010-08-23 15:54:09 UTC
In the past, rel-eng has created empty updates/14 and updates/testing/14 repositories, to handle this.  I don't want MM to have to know that undiscovered, "future" repositories should really be just empty.

Comment 5 Matt Domsch 2010-08-23 16:03:41 UTC
bah, one more patch to add back in the <?xml ?> section.  Ooops.  That's pushed upstream now too.

Comment 6 Jesse Keating 2010-09-03 21:01:01 UTC
I created the directories now, and added the creation to our SOP.


Note You need to log in before you can comment on or make changes to this bug.