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.
This commit is contained in:
Brian C. Lane 2014-12-08 15:04:10 -08:00 committed by Dennis Gilmore
parent 1bd069683c
commit 2221f66ff5
3 changed files with 11 additions and 1 deletions

View File

@ -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')

View File

@ -1407,6 +1407,10 @@ class Pungi(pypungi.PungiBase):
# run the command
lorax = pylorax.Lorax()
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,

View File

@ -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')