From: Gui Chen Date: Thu, 22 Dec 2011 05:04:59 +0000 (+0800) Subject: enable proxy support in config file X-Git-Tag: 0.3~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f45fb474a2203c6fc9dc1bd1c7d007e3b300a68;p=tools%2Fmic.git enable proxy support in config file Signed-off-by: Gui Chen --- diff --git a/mic/conf.py b/mic/conf.py index 378765d..3c3b018 100644 --- a/mic/conf.py +++ b/mic/conf.py @@ -20,7 +20,7 @@ import ConfigParser import msger import kickstart -from .utils import misc, runner, errors +from .utils import misc, runner, proxy, errors DEFAULT_GSITECONF = '/etc/mic/mic.conf' @@ -43,6 +43,8 @@ class ConfigMgr(object): "compress_disk_image": None, "distro_name": "Default Distribution", "name_prefix": None, + "proxy": None, + "no_proxy": None, }, 'chroot': {}, 'convert': {}, @@ -113,6 +115,8 @@ class ConfigMgr(object): if section in self.DEFAULTS.keys(): getattr(self, section).update(dict(parser.items(section))) + proxy.set_proxies(self.create['proxy'], self.create['no_proxy']) + def _selinux_check(self, arch, ks): """If a user needs to use btrfs or creates ARM image, selinux must be disabled at start. diff --git a/mic/utils/rpmmisc.py b/mic/utils/rpmmisc.py index 6d5cb49..f9c8f4d 100644 --- a/mic/utils/rpmmisc.py +++ b/mic/utils/rpmmisc.py @@ -22,6 +22,7 @@ import termios import rpm from mic import msger from .errors import CreatorError +from .proxy import get_proxy_for import runner def myurlgrab(url, filename, proxies, progress_obj = None): @@ -568,6 +569,9 @@ def checkRepositoryEULA(name, repo): proxy_username = repo.proxy_username proxy_password = repo.proxy_password + if not proxy: + proxy = get_proxy_for(repo.baseurl[0]) + handlers = [] auth_handler = u2.HTTPBasicAuthHandler(u2.HTTPPasswordMgrWithDefaultRealm()) u2opener = None