summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/f_hostgroup.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-12-05 15:31:18 -0500
committerRob Crittenden <rcritten@redhat.com>2008-12-10 14:15:19 -0500
commitfc8ac693726ec33b5c0924f9b8ff5d663705a5a3 (patch)
treebd8484d2ebd978a9689ab5f6178a3cd92e124692 /ipalib/plugins/f_hostgroup.py
parenta3ab787d23331cf4d060d8463ca66ff602f3629b (diff)
downloadfreeipa.git-fc8ac693726ec33b5c0924f9b8ff5d663705a5a3.tar.gz
freeipa.git-fc8ac693726ec33b5c0924f9b8ff5d663705a5a3.tar.xz
freeipa.git-fc8ac693726ec33b5c0924f9b8ff5d663705a5a3.zip
Port plugins to use the new output_for_cli() argument list
Fix some errors uncovered by the nosetests
Diffstat (limited to 'ipalib/plugins/f_hostgroup.py')
-rw-r--r--ipalib/plugins/f_hostgroup.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/ipalib/plugins/f_hostgroup.py b/ipalib/plugins/f_hostgroup.py
index 8e4c3740..6cbf4d51 100644
--- a/ipalib/plugins/f_hostgroup.py
+++ b/ipalib/plugins/f_hostgroup.py
@@ -30,6 +30,19 @@ from ipalib import ipa_types
hostgroup_filter = "groupofnames)(!(objectclass=posixGroup)"
+def get_members(members):
+ """
+ Return a list of members.
+
+ It is possible that the value passed in is None.
+ """
+ if members:
+ members = members.split(',')
+ else:
+ members = []
+
+ return members
+
class hostgroup(frontend.Object):
"""
Host Group object.
@@ -241,7 +254,7 @@ class hostgroup_add_member(frontend.Command):
to_add = []
completed = 0
- members = kw.get('groups', '').split(',')
+ members = get_members(kw.get('groups', ''))
for m in members:
if not m: continue
try:
@@ -251,7 +264,7 @@ class hostgroup_add_member(frontend.Command):
add_failed.append(m)
continue
- members = kw.get('hosts', '').split(',')
+ members = get_members(kw.get('hosts', ''))
for m in members:
if not m: continue
try:
@@ -309,7 +322,7 @@ class hostgroup_remove_member(frontend.Command):
remove_failed = []
completed = 0
- members = kw.get('groups', '').split(',')
+ members = get_members(kw.get('groups', ''))
for m in members:
if not m: continue
try:
@@ -319,7 +332,7 @@ class hostgroup_remove_member(frontend.Command):
remove_failed.append(m)
continue
- members = kw.get('hosts', '').split(',')
+ members = get_members(kw.get('hosts', ''))
for m in members:
if not m: continue
try: