Browse Source

new: dev: ``YAML`` merge error have better reporting

raw-remaining-args
Valentin Lab 7 years ago
parent
commit
1d4d439808
  1. 8
      bin/compose

8
bin/compose

@ -191,7 +191,13 @@ def merge_cli(*args):
try: try:
c = merge(*args) c = merge(*args)
except NotImplementedError as e: except NotImplementedError as e:
sys.stderr.write('%s. Conflicting key is %r. Values are:\n%s\n' % (e.args[0], e.args[1], e.args[2]))
sys.stderr.write('Merging Failed: %s.\n%s\n'
' Values are:\n %s\n'
% (e.args[0],
' Conflicting key is %r.' % e.args[1] if e.args[1] else
' Conflict at base of structure.',
'\\n '.join('v%d: %r' % (i, a)
for i, a in enumerate(e.args[2]))))
exit(1) exit(1)
if c is not None: if c is not None:
print '%s' % yaml.dump(c, default_flow_style=False) print '%s' % yaml.dump(c, default_flow_style=False)

Loading…
Cancel
Save