Add --noverifyssl to lorax (#1430483)

Previously lorax had no way to use repos with self-signed certificates.
This adds the --noverifyssl cmdline option which will ignore certificate
errors.

Resolves: rhbz#1430483
This commit is contained in:
Brian C. Lane 2017-03-17 09:07:58 -07:00
parent 8ef5f48a3e
commit d4437ce5ee

View File

@ -148,6 +148,8 @@ def main(args):
optional.add_option("--add-arch-template-var", dest="add_arch_template_vars",
action="append", help="Set variable for architecture-specific image",
default=[])
optional.add_option("--noverifyssl", action="store_true", default=False,
help="Do not verify SSL certificates")
# add the option groups to the parser
parser.add_option_group(required)
@ -196,7 +198,8 @@ def main(args):
os.mkdir(yumtempdir)
yb = get_yum_base_object(installtree, opts.source, opts.mirrorlist,
yumtempdir, opts.proxy, opts.excludepkgs)
yumtempdir, opts.proxy, opts.excludepkgs,
not opts.noverifyssl)
if yb is None:
print("error: unable to create the yumbase object", file=sys.stderr)
@ -233,7 +236,8 @@ def main(args):
def get_yum_base_object(installroot, repositories, mirrorlists=[],
tempdir="/var/tmp", proxy=None, excludepkgs=[]):
tempdir="/var/tmp", proxy=None, excludepkgs=[],
sslverify=True):
def sanitize_repo(repo):
"""Convert bare paths to file:/// URIs, and silently reject protocols unhandled by yum"""
@ -271,6 +275,9 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[],
if proxy:
data["proxy"] = proxy
if sslverify == False:
data["sslverify"] = "0"
if excludepkgs:
data["exclude"] = " ".join(excludepkgs)