lorax: Add --proxy command

This commit is contained in:
Brian C. Lane 2011-12-20 18:13:30 -08:00
parent 0434b7d47a
commit 10acb5e5b9

View File

@ -65,6 +65,8 @@ def main(args):
action="store_true", default=False, dest="is_beta")
optional.add_option("-c", "--config", default="/etc/lorax/lorax.conf",
help="config file", metavar="STRING")
optional.add_option("--proxy", default=None,
help="repo proxy url:port", metavar="STRING")
# add the option groups to the parser
parser.add_option_group(required)
@ -101,7 +103,7 @@ def main(args):
os.mkdir(yumtempdir)
yb = get_yum_base_object(installtree, opts.source, opts.mirrorlist,
yumtempdir)
yumtempdir, opts.proxy)
if yb is None:
print("error: unable to create the yumbase object", file=sys.stderr)
@ -117,7 +119,7 @@ def main(args):
def get_yum_base_object(installroot, repositories, mirrorlists=[],
tempdir="/tmp"):
tempdir="/tmp", proxy=None):
def sanitize_repo(repo):
if repo.startswith("/"):
@ -152,6 +154,9 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[],
"reposdir": "",
"tsflags": "nodocs"}
if proxy:
data["proxy"] = proxy
c.add_section(section)
map(lambda (key, value): c.set(section, key, value), data.items())