Split Cekit.run into run, configure
Split the run() method into a configure() method and a run()
method that calls it.
This means we can write tests for the configure() code without
invoking run() and generating Dockerfiles etc.
(Review tip: try ignoring whitespace changes with "git show HEAD -w")
@@ -160,7 +160,7 @@ class Cekit(object):
return self
- def run(self):
+ def configure(self):
if self.args.verbose:
logger.setLevel(logging.DEBUG)
else:
@@ -171,7 +171,6 @@ class Cekit(object):
logger.warning("You are running unreleased development version of Cekit, "
"use it only at your own risk!")
- try:
tools.cfg = tools.get_cfg(self.args.config)
tools.cleanup(self.args.target)
@@ -183,12 +182,18 @@ class Cekit(object):
# We need to construct Generator first, because we need overrides
# merged in
params = {'redhat': tools.cfg['common']['redhat']}
- generator = Generator(self.args.descriptor,
+ self.generator = Generator(self.args.descriptor,
self.args.target,
self.args.build_engine,
self.args.overrides,
params)
+ def run(self):
+
+ try:
+ self.configure()
+ generator = self.generator
+
# Now we can fetch repositories of modules (we have all overrides)
get_dependencies(generator.image,
os.path.join(self.args.target, 'repo'))
