From f26a6212d624fd7296200a1835c6e8e056829d04 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 10 May 2018 13:36:49 -0700 Subject: [PATCH] Add --proxy to lorax-composer cmdline Overrides the [yum] proxy setting in the config file. --- src/pylorax/api/config.py | 2 ++ src/sbin/lorax-composer | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/pylorax/api/config.py b/src/pylorax/api/config.py index 79ad6f41..2070a7d4 100644 --- a/src/pylorax/api/config.py +++ b/src/pylorax/api/config.py @@ -58,6 +58,8 @@ def configure(conf_file="/etc/lorax/composer.conf", root_dir="/", test_config=Fa conf.set("repos", "use_system_repos", "1") conf.set("repos", "enabled", "*") + conf.add_section("yum") + if not test_config: # read the config file if os.path.isfile(conf_file): diff --git a/src/sbin/lorax-composer b/src/sbin/lorax-composer index 6deecec0..d966b699 100755 --- a/src/sbin/lorax-composer +++ b/src/sbin/lorax-composer @@ -70,6 +70,8 @@ def get_parser(): help="Release version to use for $releasever in yum repository urls" ) parser.add_argument("--tmp", default="/var/tmp", help="Top level temporary directory") + parser.add_argument("--proxy", default=None, metavar="PROXY", + help="Set proxy for DNF, overrides configuration file setting.") parser.add_argument("BLUEPRINTS", metavar="BLUEPRINTS", help="Path to the blueprints") @@ -226,6 +228,10 @@ if __name__ == '__main__': if opts.sharedir: server.config["COMPOSER_CFG"].set("composer", "share_dir", opts.sharedir) + # Override the config file's DNF proxy setting + if opts.proxy: + server.config["COMPOSER_CFG"].set("yum", "proxy", opts.proxy) + # Make sure the queue paths are setup correctly, exit on errors errors = make_queue_dirs(server.config["COMPOSER_CFG"], gid) if errors: