diff options
author | Martin Basti <mbasti@redhat.com> | 2016-05-13 17:08:43 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-06-03 15:58:21 +0200 |
commit | 79544aa51acc6f48117391b1e0ec70e9f4d7d0bb (patch) | |
tree | afd718c69973f55211888f77d0531b81a9e37426 /ipaclient | |
parent | 15abfcf0f77664f426ba50ebf20e0f6c2a6f8275 (diff) | |
download | freeipa-79544aa51acc6f48117391b1e0ec70e9f4d7d0bb.tar.gz freeipa-79544aa51acc6f48117391b1e0ec70e9f4d7d0bb.tar.xz freeipa-79544aa51acc6f48117391b1e0ec70e9f4d7d0bb.zip |
DNS Location: location-show: return list of servers in location
location-show returns list of servers curently assigned to the location
https://fedorahosted.org/freeipa/ticket/2008
Reviewed-By: Petr Spacek <pspacek@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaclient')
-rw-r--r-- | ipaclient/plugins/location.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ipaclient/plugins/location.py b/ipaclient/plugins/location.py new file mode 100644 index 000000000..b3b6026c0 --- /dev/null +++ b/ipaclient/plugins/location.py @@ -0,0 +1,35 @@ +# +# Copyright (C) 2016 FreeIPA Contributors see COPYING for license +# + +from ipaclient.frontend import MethodOverride +from ipalib import _ +from ipalib.plugable import Registry + + +register = Registry() + + +@register(override=True) +class location_show(MethodOverride): + def output_for_cli(self, textui, output, *keys, **options): + rv = super(location_show, self).output_for_cli( + textui, output, *keys, **options) + + servers = output.get('servers', {}) + first = True + for hostname, details in servers.items(): + if first: + textui.print_indented(_("Servers details:"), indent=1) + first = False + else: + textui.print_line("") + + for param in self.api.Command.server_find.output_params(): + if param.name in details: + textui.print_indented( + u"{}: {}".format( + param.label, u', '.join(details[param.name])), + indent=2) + + return rv |