summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/hostgroup.py
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-07-31 14:18:31 +0200
committerMartin Kosek <mkosek@redhat.com>2014-09-30 10:42:06 +0200
commit936eaada89061456a30927ba95a9836f76a88045 (patch)
tree3b47bc641e2afea6f505ed2c73de310444bfe74c /ipalib/plugins/hostgroup.py
parent377ab0c4a6f9f61f2a00844a2cea9233d908bbb1 (diff)
downloadfreeipa-936eaada89061456a30927ba95a9836f76a88045.tar.gz
freeipa-936eaada89061456a30927ba95a9836f76a88045.tar.xz
freeipa-936eaada89061456a30927ba95a9836f76a88045.zip
hostgroup: Add helper that returns all members of a hostgroup
Part of: https://fedorahosted.org/freeipa/ticket/3979 Reviewed-By: Petr Viktorin <pviktori@redhat.com> Reviewed-By: Petr Vobornik <pvoborni@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Diffstat (limited to 'ipalib/plugins/hostgroup.py')
-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 4161cb1ba..a86350958 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()