summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-07-31 14:18:31 +0200
committerTomas Babej <tbabej@redhat.com>2014-09-17 14:41:50 +0200
commit378b766bd2c0152b4de476c69a5cb4020b1ddc1c (patch)
tree17543869f68e112548497db9a3b151904842a56d
parent9793e44380f8fcdefa1a33fad5fad30ac9a9ac3f (diff)
downloadfreeipa-378b766bd2c0152b4de476c69a5cb4020b1ddc1c.zip
freeipa-378b766bd2c0152b4de476c69a5cb4020b1ddc1c.tar.gz
freeipa-378b766bd2c0152b4de476c69a5cb4020b1ddc1c.tar.xz
hostgroup: Add helper that returns all members of a hostgroup
Part of: https://fedorahosted.org/freeipa/ticket/3979
-rw-r--r--ipalib/plugins/hostgroup.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ipalib/plugins/hostgroup.py b/ipalib/plugins/hostgroup.py
index 0e86e99..04891cc 100644
--- a/ipalib/plugins/hostgroup.py
+++ b/ipalib/plugins/hostgroup.py
@@ -54,6 +54,14 @@ EXAMPLES:
ipa hostgroup-del baltimore
""")
+
+def get_complete_hostgroup_member_list(hostgroup):
+ result = api.Command['hostgroup_show'](hostgroup)['result']
+ direct = list(result.get('member_host', []))
+ indirect = list(result.get('memberindirect_host', []))
+ return direct + indirect
+
+
register = Registry()
@register()