diff options
author | Ryan Groten <rgroten@gmail.com> | 2017-12-18 10:28:19 -0700 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2017-12-18 12:28:19 -0500 |
commit | b34d150becfdb908da37e4b4964801578eba3956 (patch) | |
tree | 0c4602585cffd0a0ac915bdd07c4bc17754b1a98 /contrib | |
parent | 2cdbde524b77bf3ff340ece6f89531261aa32c78 (diff) | |
download | ansible-b34d150becfdb908da37e4b4964801578eba3956.tar.gz |
Use hostgroup_find(all=True) returns member hosts of all hostgroups in a single call (#29106)
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/inventory/freeipa.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/contrib/inventory/freeipa.py b/contrib/inventory/freeipa.py index e2e4c9a9e7..20f5626aed 100755 --- a/contrib/inventory/freeipa.py +++ b/contrib/inventory/freeipa.py @@ -5,7 +5,6 @@ import argparse from ipalib import api import json -from distutils.version import StrictVersion def initialize(): @@ -35,15 +34,11 @@ def list_groups(api): inventory = {} hostvars = {} - ipa_version = api.Command.env()['result']['version'] - result = api.Command.hostgroup_find()['result'] + result = api.Command.hostgroup_find(all=True)['result'] for hostgroup in result: # Get direct and indirect members (nested hostgroups) of hostgroup members = [] - if StrictVersion(ipa_version) >= StrictVersion('4.0.0'): - hostgroup_name = hostgroup['cn'][0] - hostgroup = api.Command.hostgroup_show(hostgroup_name)['result'] if 'member_host' in hostgroup: members = [host for host in hostgroup['member_host']] |