check-mirrors check-mirrors.py,1.30,1.31
Michael Patrick McGrath (mmcgrath)
fedora-extras-commits at redhat.com
Wed Sep 27 01:50:01 UTC 2006
Author: mmcgrath
Update of /cvs/fedora/check-mirrors
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20010
Modified Files:
check-mirrors.py
Log Message:
Fixed bug where completely non xml file was not being flaged as a damaged repo file.
Index: check-mirrors.py
===================================================================
RCS file: /cvs/fedora/check-mirrors/check-mirrors.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- check-mirrors.py 25 Aug 2006 00:53:42 -0000 1.30
+++ check-mirrors.py 27 Sep 2006 01:49:59 -0000 1.31
@@ -221,15 +221,20 @@
parser = iterparse(infile)
try:
+ foundData = 0
for event, elem in parser:
elem_name = ns_cleanup(elem.tag)
if elem_name == "data":
+ foundData = 1
thisdata = RepoData(elem=elem)
self.repoData[thisdata.type] = thisdata
except SyntaxError, e:
raise RepoMDError, "Damaged repomd.xml file"
+ if foundData == 0:
+ raise RepoMDError, "Damaged repomd.xml file"
+
def fileTypes(self):
"""return list of metadata file types available"""
return self.repoData.keys()
@@ -288,11 +293,12 @@
errorprint("Grabber error on %s arch %s was:\n%s" % (url, arch, e))
continue
else:
- thisdata = p.repoData['primary']
- self.timestamps[arch] = thisdata.timestamp
- del p
- fo.close()
- del fo
+ thisdata = p.repoData['primary']
+ self.timestamps[arch] = thisdata.timestamp
+ del p
+ fo.close()
+ del fo
+
def get_country(self, url):
url_parts = urlparse.urlparse(url)
@@ -479,7 +485,7 @@
if not goodmirror:
debugprint("Bad: %s, %s, %s, %s" % (s.mirrorid, arch, m.country, m.url))
DB.badmirror(s.mirrorid, arch, m.country, m.url)
- print "Bad: %s, %s, %s, %s" % (s.mirrorid, arch, m.country, m.url)
+ debugprint("Bad: %s, %s, %s, %s" % (s.mirrorid, arch, m.country, m.url))
global_file = '%s/%s-global-%s.txt' % (s.outputpath, s.mirrorid, arch)
glob_fo = open(global_file, 'w')
for url in glob_urls:
@@ -493,7 +499,7 @@
for url in country_specific[code]:
country_fo.write('%s\n' % url)
DB.goodmirror(s.mirrorid, arch, code, url)
- print "Good: %s, %s, %s, %s" % (s.mirrorid, arch, m.country, m.url)
+ debugprint("Good: %s, %s, %s, %s" % (s.mirrorid, arch, m.country, m.url))
new_file_list.append(os.path.normpath(country_file))
# clean up
More information about the fedora-extras-commits
mailing list