lorax: Add --proxy command
This commit is contained in:
parent
0434b7d47a
commit
10acb5e5b9
@ -65,6 +65,8 @@ def main(args):
|
|||||||
action="store_true", default=False, dest="is_beta")
|
action="store_true", default=False, dest="is_beta")
|
||||||
optional.add_option("-c", "--config", default="/etc/lorax/lorax.conf",
|
optional.add_option("-c", "--config", default="/etc/lorax/lorax.conf",
|
||||||
help="config file", metavar="STRING")
|
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
|
# add the option groups to the parser
|
||||||
parser.add_option_group(required)
|
parser.add_option_group(required)
|
||||||
@ -101,7 +103,7 @@ def main(args):
|
|||||||
os.mkdir(yumtempdir)
|
os.mkdir(yumtempdir)
|
||||||
|
|
||||||
yb = get_yum_base_object(installtree, opts.source, opts.mirrorlist,
|
yb = get_yum_base_object(installtree, opts.source, opts.mirrorlist,
|
||||||
yumtempdir)
|
yumtempdir, opts.proxy)
|
||||||
|
|
||||||
if yb is None:
|
if yb is None:
|
||||||
print("error: unable to create the yumbase object", file=sys.stderr)
|
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=[],
|
def get_yum_base_object(installroot, repositories, mirrorlists=[],
|
||||||
tempdir="/tmp"):
|
tempdir="/tmp", proxy=None):
|
||||||
|
|
||||||
def sanitize_repo(repo):
|
def sanitize_repo(repo):
|
||||||
if repo.startswith("/"):
|
if repo.startswith("/"):
|
||||||
@ -152,6 +154,9 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[],
|
|||||||
"reposdir": "",
|
"reposdir": "",
|
||||||
"tsflags": "nodocs"}
|
"tsflags": "nodocs"}
|
||||||
|
|
||||||
|
if proxy:
|
||||||
|
data["proxy"] = proxy
|
||||||
|
|
||||||
c.add_section(section)
|
c.add_section(section)
|
||||||
map(lambda (key, value): c.set(section, key, value), data.items())
|
map(lambda (key, value): c.set(section, key, value), data.items())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user