mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Display the entries that failed when deleting with --continue.
We collected the failures but didn't report it back. This changes the API of most delete commands so rather than returning a boolean it returns a dict with the only current key as failed. This also adds a new parameter flag, suppress_empty. This will try to not print values that are empty if included. This makes the output of the delete commands a bit prettier. ticket 687
This commit is contained in:
@@ -326,16 +326,16 @@ class textui(backend.Backend):
|
||||
for attr in sorted(entry):
|
||||
print_attr(attr)
|
||||
|
||||
def print_entries(self, entries, order=None, labels=None, print_all=True, format='%s: %s', indent=1):
|
||||
def print_entries(self, entries, order=None, labels=None, flags=None, print_all=True, format='%s: %s', indent=1):
|
||||
assert isinstance(entries, (list, tuple))
|
||||
first = True
|
||||
for entry in entries:
|
||||
if not first:
|
||||
print ''
|
||||
first = False
|
||||
self.print_entry(entry, order, labels, print_all, format, indent)
|
||||
self.print_entry(entry, order, labels, flags, print_all, format, indent)
|
||||
|
||||
def print_entry(self, entry, order=None, labels=None, print_all=True, format='%s: %s', indent=1):
|
||||
def print_entry(self, entry, order=None, labels=None, flags=None, print_all=True, format='%s: %s', indent=1):
|
||||
"""
|
||||
"""
|
||||
if isinstance(entry, (list, tuple)):
|
||||
@@ -351,7 +351,10 @@ class textui(backend.Backend):
|
||||
if key not in entry:
|
||||
continue
|
||||
label = labels.get(key, key)
|
||||
flag = flags.get(key, [])
|
||||
value = entry[key]
|
||||
if 'suppress_empty' in flag and value in [u'', '', [], None]:
|
||||
continue
|
||||
if isinstance(value, dict):
|
||||
if frontend.entry_count(value) == 0:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user