From 1639df68629aee75ce91c492dfdde67849abc872 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 26 Sep 2017 15:48:37 -0700 Subject: [PATCH] Set the releasever and install gpg keys when using --repo This uses the --release value as the yum releasever so that $releasever in a --repo will work. It also turns on assumeyes so that any gpgkey entries in the .repo file will be installed and used automatically if gpgcheck is enabled for the repo. Related: rhbz#1430479 --- src/sbin/lorax | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sbin/lorax b/src/sbin/lorax index a4e481eb..b60c7ce7 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -199,7 +199,7 @@ def main(args): yb = get_yum_base_object(installtree, opts.source, opts.mirrorlist, opts.repo_files, yumtempdir, opts.proxy, opts.excludepkgs, - not opts.noverifyssl) + not opts.noverifyssl, opts.release) if yb is None: print("error: unable to create the yumbase object", file=sys.stderr) @@ -237,7 +237,7 @@ def main(args): def get_yum_base_object(installroot, repositories, mirrorlists=[], repo_files=[], tempdir="/var/tmp", proxy=None, excludepkgs=[], - sslverify=True): + sslverify=True, releasever=None): def sanitize_repo(repo): """Convert bare paths to file:/// URIs, and silently reject protocols unhandled by yum""" @@ -269,6 +269,7 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[], repo_files=[] "keepcache": 0, "gpgcheck": 0, "plugins": 0, + "assumeyes": 1, "reposdir": "", "tsflags": "nodocs"} @@ -325,6 +326,8 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[], repo_files=[] yb.preconf.fn = yumconf yb.preconf.root = installroot #yb.repos.setCacheDir(cachedir) + if releasever: + yb.preconf.releasever = releasever # Turn on as much yum logging as we can yb.preconf.debuglevel = 6