Ticket #796 (closed defect: fixed)
Packages APTSource 404 urllib2 traceback
Reported by: | [email protected]… | Owned by: | desai |
---|---|---|---|
Priority: | minor | Milestone: | Bcfg2 1.0.1 Release |
Component: | bcfg2-server | Version: | 1.0 |
Keywords: | packages urllib2 | Cc: |
Description
With an entry like this in Packages/config.xml
<APTSource>
<Group>debian-lenny</Group> <URL>http://security.debian.org</URL> <Version>lenny/updates</Version> <Component>main</Component> <Component>contrib</Component> <Component>non-free</Component> <Arch>i386</Arch> <Arch>amd64</Arch>
</APTSource>
Causes a traceback in the logs on start
bcfg2-server[19315]: Packages: Updating http://security.debian.org//dists/lenny/updates/non-free/binary-amd64/Packages.gz bcfg2-server[19315]: Packages: Failed to fetch url http://security.debian.org//dists/lenny/updates/non-free/binary-amd64/Packages.gz. code=404 bcfg2-server[19315]: Unexpected instantiation failure for plugin Packages Traceback (most recent call last): File "/var/lib/python-support/python2.5/Bcfg2/Server/Core.py", line 131, in init_plugins self.plugins[plugin] = plug(self, self.datastore) File "/var/lib/python-support/python2.5/Bcfg2/Server/Plugins/Packages.py", line 515, in init source.setup_data() File "/var/lib/python-support/python2.5/Bcfg2/Server/Plugins/Packages.py", line 82, in setup_data self.read_files() File "/var/lib/python-support/python2.5/Bcfg2/Server/Plugins/Packages.py", line 414, in read_files reader = gzip.GzipFile?(fname) File "/usr/lib/python2.5/gzip.py", line 95, in init fileobj = self.myfileobj = builtin.open(filename, mode or 'rb') IOError: [Errno 2] No such file or directory: '/var/lib/bcfg2/Packages/cache/http:@@[email protected]@[email protected]@[email protected]@[email protected]'
Removing the extra '/' addition at line 391 of Packages.py is a workaround:
--- Packages.py.orig 2009-11-11 22:53:28.000000000 +0000 +++ Packages.py 2009-11-11 22:53:37.000000000 +0000 @@ -391,7 +391,7 @@
self.pkgnames, self.deps, self.provides = cPickle.load(data)
def get_urls(self):
- return ["%s/dists/%s/%s/binary-%s/Packages.gz" % \
+ return ["%sdists/%s/%s/binary-%s/Packages.gz" % \
(self.url, self.version, part, arch) for part in self.components \ for arch in self.arches]
urls = property(get_urls)
$ python -V Python 2.5.2
Committed in [fbe20241d187ac38f2bde7e00b6d71a21b558e99] (SVN r5572). Thanks for the patch. This was a combination of our bug and python 2.6's urllib2 improvements. (it worked fine in 2.6, but not in 2.5)