Merge "Move some file creation code from main to utils"
This commit is contained in:
commit
568d51bca2
|
@ -103,13 +103,7 @@ def start_engine(args):
|
|||
}
|
||||
utils.write_yaml(cfg, engine_cfg)
|
||||
# create cfg files
|
||||
for filename in ['audit_cfg', 'repair_cfg']:
|
||||
try:
|
||||
with open(cfg_data[filename]):
|
||||
pass
|
||||
except IOError:
|
||||
with open(cfg_data[filename], 'a'):
|
||||
pass
|
||||
utils.create_files([cfg_data['audit_cfg'], cfg_data['repair_cfg']])
|
||||
LOG.info('Added %s to engine cfg', args.name)
|
||||
entropy_engine = Engine(args.name, **cfg_data)
|
||||
entropy_engine.run()
|
||||
|
|
|
@ -223,3 +223,12 @@ class StopWatch(object):
|
|||
self._stopped_at = wallclock()
|
||||
self._state = self._STOPPED
|
||||
return self
|
||||
|
||||
|
||||
def create_files(list_of_files):
|
||||
if not list_of_files:
|
||||
return
|
||||
for filename in list_of_files:
|
||||
if not os.path.isfile(filename):
|
||||
with open(filename, 'w'):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue