summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/f_service.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-12-10 16:42:45 -0500
committerRob Crittenden <rcritten@redhat.com>2008-12-10 16:42:45 -0500
commitaf7b5645af001352aff626f46ec39031b2e9b10a (patch)
tree35d82b1902c0ef3d8fbd45c969d75fb01f21377c /ipalib/plugins/f_service.py
parent5ad47d70bee9858506fbff5a9327ca081deea495 (diff)
downloadfreeipa.git-af7b5645af001352aff626f46ec39031b2e9b10a.tar.gz
freeipa.git-af7b5645af001352aff626f46ec39031b2e9b10a.tar.xz
freeipa.git-af7b5645af001352aff626f46ec39031b2e9b10a.zip
Convert to new output_for_cli() function
Diffstat (limited to 'ipalib/plugins/f_service.py')
-rw-r--r--ipalib/plugins/f_service.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/ipalib/plugins/f_service.py b/ipalib/plugins/f_service.py
index 04187a86..fc0ae65e 100644
--- a/ipalib/plugins/f_service.py
+++ b/ipalib/plugins/f_service.py
@@ -158,22 +158,20 @@ class service_find(crud.Find):
return ldap.search(**kw)
- def output_for_cli(self, services):
- if not services:
- return
-
- counter = services[0]
- services = services[1:]
+ def output_for_cli(self, textui, result, *args, **options):
+ counter = result[0]
+ services = result[1:]
if counter == 0:
- print "No entries found"
+ textui.print_plain("No entries found")
return
- elif counter == -1:
- print "These results are truncated."
- print "Please refine your search and try again."
for s in services:
- for a in s.keys():
- print "%s: %s" % (a, s[a])
+ textui.print_entry(s)
+
+ if counter == -1:
+ textui.print_plain("These results are truncated.")
+ textui.print_plain("Please refine your search and try again.")
+ textui.print_count(services, '%d services matched')
api.register(service_find)
@@ -196,11 +194,7 @@ class service_show(crud.Get):
dn = ldap.find_entry_dn("krbprincipalname", principal)
# FIXME: should kw contain the list of attributes to display?
return ldap.retrieve(dn)
- def output_for_cli(self, service):
- if not service:
- return
-
- for a in service.keys():
- print "%s: %s" % (a, service[a])
+ def output_for_cli(self, textui, result, *args, **options):
+ textui.print_entry(result)
api.register(service_show)