Recreate JSON dump of configuration
We need both full dump and the copy of original file. Having just the copy is not sufficient because while it preserves comments and formatting, there can be include statements for other files and those are not copied. With this patch we create the dump in the same way as before, and additionally create a copy of of the config file specified on command line. Fixes: #398 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
3a68a93532
commit
bfe1068b8e
@ -11,6 +11,7 @@ import datetime
|
||||
import getpass
|
||||
import socket
|
||||
import pipes
|
||||
import json
|
||||
|
||||
here = sys.path[0]
|
||||
if here != '/usr/bin':
|
||||
@ -221,8 +222,11 @@ def run_compose(compose):
|
||||
|
||||
# dump the config file
|
||||
date_str = datetime.datetime.strftime(datetime.datetime.now(), "%F_%X").replace(":", "-")
|
||||
config_dump = compose.paths.log.log_file("global", "config-dump_%s" % date_str)
|
||||
config_dump = compose.paths.log.log_file("global", "config-copy_%s" % date_str)
|
||||
open(config_dump, "w").write(open(compose.conf._open_file, 'r').read())
|
||||
config_dump_full = compose.paths.log.log_file("global", "config-dump_%s" % date_str)
|
||||
with open(config_dump_full, "w") as f:
|
||||
json.dump(compose.conf, f, sort_keys=True, indent=4)
|
||||
|
||||
# initialize all phases
|
||||
init_phase = pungi.phases.InitPhase(compose)
|
||||
|
Loading…
Reference in New Issue
Block a user