FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 12-04-2010, 12:48 AM
"Brian C. Lane"
 
Default Add proxy handling to .treeinfo (#634655)

Add a string with the correct method and auth info to the parent object
for use with things like urlgrabber that need a full url

Tested with proxy, proxy+auth, repo+proxy kickstart and no proxy

Resolves: rhbz#634655
---
yuminstall.py | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 9c8c210..c936553 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -260,6 +260,7 @@ class AnacondaYumRepo(YumRepository):
YumRepository.__init__(self, *args, **kwargs)
self.enablegroups = True
self._anacondaBaseURLs = []
+ self.proxy_url = None

def needsNetwork(self):
def _isURL(s):
@@ -677,7 +678,7 @@ class AnacondaYum(YumSorter):
c = ConfigParser()

# If there's no .treeinfo for this repo, don't bother looking for addons.
- treeinfo = self._getTreeinfo(baseurl)
+ treeinfo = self._getTreeinfo(baseurl, repo.proxy_url)
if not treeinfo:
return retval

@@ -702,7 +703,11 @@ class AnacondaYum(YumSorter):

return retval

- def _getTreeinfo(self, baseurl):
+ def _getTreeinfo(self, baseurl, proxy_url=None):
+ """
+ Try to get .treeinfo file from baseurl, optionally using proxy_url
+ Saves the file into /tmp/.treeinfo
+ """
if baseurl.startswith("http") or baseurl.startswith("ftp"):
if not network.hasActiveNetDev():
if not self.anaconda.intf.enableNetwork():
@@ -711,25 +716,36 @@ class AnacondaYum(YumSorter):
urlgrabber.grabber.reset_curl_obj()

ug = URLGrabber()
+ if proxy_url and proxy_url.startswith("http"):
+ proxies = { 'http' : proxy_url,
+ 'https' : proxy_url }
+ elif proxy_url and proxy_url.startswith("ftp"):
+ proxies = { 'ftp' : proxy_url }
+ else:
+ proxies = {}

try:
- ug.urlgrab("%s/.treeinfo" % baseurl, "/tmp/.treeinfo", copy_local=1)
+ ug.urlgrab("%s/.treeinfo" % baseurl, "/tmp/.treeinfo",
+ copy_local=1, proxies=proxies)
except Exception as e:
try:
- ug.urlgrab("%s/treeinfo" % baseurl, "/tmp/.treeinfo", copy_local=1)
+ ug.urlgrab("%s/treeinfo" % baseurl, "/tmp/.treeinfo",
+ copy_local=1, proxies=proxies)
except Exception as e:
log.error("Error downloading treeinfo file: %s" % e)
return None

return "/tmp/.treeinfo"

- # We need to make sure $releasever gets set up before .repo files are
- # read. Since there's no redhat-release package in /mnt/sysimage (and
- # won't be for quite a while), we need to do our own substutition.
def _getReleasever(self):
+ """
+ We need to make sure $releasever gets set up before .repo files are
+ read. Since there's no redhat-release package in /mnt/sysimage (and
+ won't be for quite a while), we need to do our own substutition.
+ """
c = ConfigParser()

- treeinfo = self._getTreeinfo(self._baseRepoURL)
+ treeinfo = self._getTreeinfo(self._baseRepoURL, self.proxy_url)
if not treeinfo:
return productVersion

--
1.7.3.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 10:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org