diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-11-17 16:40:42 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-11-17 16:40:42 -0700 |
commit | 12dc0a0aa916c9289fe7fb36eddf887e3a53775e (patch) | |
tree | 329aa4b416c3e108cf2e2da91ec58527609db59e | |
parent | 42bf555a3ad1f1777b26a4092b49512b9360c882 (diff) | |
download | freeipa-12dc0a0aa916c9289fe7fb36eddf887e3a53775e.tar.gz freeipa-12dc0a0aa916c9289fe7fb36eddf887e3a53775e.tar.xz freeipa-12dc0a0aa916c9289fe7fb36eddf887e3a53775e.zip |
user-find now works again, uses textui
-rw-r--r-- | ipa_server/plugins/b_ldap.py | 2 | ||||
-rw-r--r-- | ipalib/plugins/f_user.py | 29 |
2 files changed, 18 insertions, 13 deletions
diff --git a/ipa_server/plugins/b_ldap.py b/ipa_server/plugins/b_ldap.py index fe3299197..862de1d86 100644 --- a/ipa_server/plugins/b_ldap.py +++ b/ipa_server/plugins/b_ldap.py @@ -252,7 +252,7 @@ class ldap(CrudBackend): result = self.retrieve(dn, ["*"]) entry = ipaldap.Entry((dn, servercore.convert_scalar_values(result))) - + kw = dict(self.strip_none(kw)) for k in kw: entry.setValues(k, kw[k]) diff --git a/ipalib/plugins/f_user.py b/ipalib/plugins/f_user.py index e96d787b0..eed6d8ab7 100644 --- a/ipalib/plugins/f_user.py +++ b/ipalib/plugins/f_user.py @@ -292,21 +292,26 @@ class user_find(crud.Find): else: kw['attributes'] = default_attributes return ldap.search(**kw) - def output_for_cli(self, users): - if not users: + + def output_for_cli(self, textui, result, uid, **options): + counter = result[0] + users = result[1:] + if counter == 0 or len(users) == 0: + textui.print_plain("No entries found") return - counter = users[0] - users = users[1:] - if counter == 0: - print "No entries found" + if len(users) == 1: + textui.print_entry(users[0]) return - elif counter == -1: - print "These results are truncated." - print "Please refine your search and try again." - + textui.print_name(self.name) for u in users: - display_user(u) - print "" + textui.print_plain('%(givenname)s %(sn)s:' % u) + textui.print_entry(u) + textui.print_plain('') + if counter == -1: + textui.print_plain('These results are truncated.') + textui.print_plain('Please refine your search and try again.') + textui.print_count(users, '%d users matched') + api.register(user_find) |