[enh] Also show diff as needed with --list-pending in service_regen_conf

This commit is contained in:
Jérôme Lebleu 2016-04-11 20:42:21 +02:00
parent a06a753fb6
commit 9229210538

View file

@ -285,9 +285,18 @@ def service_regen_conf(names=[], with_diff=False, force=False,
"""
result = {}
# Just return pending conf
# Return the list of pending conf
if list_pending:
return _get_pending_conf(names)
pending_conf = _get_pending_conf(names)
if with_diff:
for service, conf_files in pending_conf.items():
for system_path, pending_path in conf_files.items():
pending_conf[service][system_path] = {
'pending_conf': pending_path,
'diff': _get_files_diff(
system_path, pending_path, True),
}
return pending_conf
# Clean pending conf directory
shutil.rmtree(pending_conf_dir, ignore_errors=True)