improve display of actions and errors

This commit is contained in:
Benjamin Dauvergne 2016-02-19 16:28:58 +01:00
parent 3f7c3376b0
commit aaca0125ba
2 changed files with 6 additions and 6 deletions

View File

@ -136,7 +136,7 @@ Base DN of the source is remapped to another DN in the target directory''')
synchronize.build_actions()
if options.verbose:
for action in synchronize.actions:
print action
print ' -', action
if not synchronize.actions:
print 'Nothing to do.'
if not options.fake:
@ -145,5 +145,7 @@ Base DN of the source is remapped to another DN in the target directory''')
if failed_actions:
print >>sys.stderr, 'Some actions failed:'
for action in failed_actions:
print >>sys.stderr, action, action.errors
print ' -', action
for error in action.errors:
print ' *', error
raise SystemExit(1)

View File

@ -52,11 +52,9 @@ class Action(object):
self.errors.append(e)
def __str__(self):
s = '<%s dn: %s' % (self.__class__.__name__, self.dn)
if self.entry:
s += ' entry: %s' % self.entry
s = '%s %s' % (self.__class__.__name__, self.dn)
if self.new_dn:
s += ' new_dn: %s' % self.new_dn
s += ' to %s' % self.new_dn
return s