From 2221f66ff5ad890bb632c02591d1ed0f213900dc Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 8 Dec 2014 15:04:10 -0800 Subject: [PATCH] Add a cmdline option to set the lorax config file Add --lorax-conf which will be used to point lorax to a INI style config file. Useful for running things from a git checkout instead of installed system. --- src/bin/pungi.py | 5 +++++ src/pypungi/__init__.py | 6 +++++- src/pypungi/config.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bin/pungi.py b/src/bin/pungi.py index aa831a66..8a7ddd64 100755 --- a/src/bin/pungi.py +++ b/src/bin/pungi.py @@ -113,6 +113,9 @@ def main(): config.set("pungi", "nosource", str(bool(opts.nosource))) config.set("pungi", "nodebuginfo", str(bool(opts.nodebuginfo))) + if opts.lorax_conf: + config.set("lorax", "conf_file", opts.lorax_conf) + # Actually do work. mypungi = pypungi.Pungi(config, ksparser) @@ -260,6 +263,8 @@ if __name__ == '__main__': help='base working directory (defaults to destdir + /work)') parser.add_option("--no-dvd", default=False, action="store_true", dest="no_dvd", help='Do not make a install DVD/CD only the netinstall image and the tree') + parser.add_option("--lorax-conf", type="string", + help='Path to lorax.conf file (optional)') parser.add_option("-c", "--config", dest="config", help='Path to kickstart config file') diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py index 6a1d474e..5bf0e7b6 100644 --- a/src/pypungi/__init__.py +++ b/src/pypungi/__init__.py @@ -1407,7 +1407,11 @@ class Pungi(pypungi.PungiBase): # run the command lorax = pylorax.Lorax() - lorax.configure() + try: + conf_file = self.config.get('lorax', 'conf_file') + lorax.configure(conf_file=conf_file) + except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + lorax.configure() lorax.run(self.ayum, product=product, version=version, release=release, variant=variant, bugurl=bugurl, isfinal=isfinal, domacboot=domacboot, diff --git a/src/pypungi/config.py b/src/pypungi/config.py index 4305d4fa..8856857c 100644 --- a/src/pypungi/config.py +++ b/src/pypungi/config.py @@ -23,6 +23,7 @@ class Config(SafeConfigParser): SafeConfigParser.__init__(self) self.add_section('pungi') + self.add_section('lorax') self.set('pungi', 'osdir', 'os') self.set('pungi', 'sourcedir', 'source')