diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-01-07 11:17:55 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-01-10 10:32:10 -0500 |
commit | 6f58f38748085e6a104de6f9e992469d3b685d5a (patch) | |
tree | ebc3a92f95feae19afc8ababcf306782e62988f8 /ipalib/cli.py | |
parent | 0a79836082b897ebf734d9073583769cb276937c (diff) | |
download | freeipa-6f58f38748085e6a104de6f9e992469d3b685d5a.tar.gz freeipa-6f58f38748085e6a104de6f9e992469d3b685d5a.tar.xz freeipa-6f58f38748085e6a104de6f9e992469d3b685d5a.zip |
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
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 436607f27..892db8081 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -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 |