Hi,

Since passing --hosts= or --hostsgroups= to idview-apply or unapply
commands does not make sense, ignore it.

https://fedorahosted.org/freeipa/ticket/4806

-- 
Tomas Babej
Associate Software Engineer | Red Hat | Identity Management
RHCE | Brno Site | IRC: tbabej | freeipa.org 


>From 02e8d68c644f451c3712861b9b85f2d80811fea4 Mon Sep 17 00:00:00 2001
From: Tomas Babej <tba...@redhat.com>
Date: Fri, 12 Dec 2014 16:47:49 +0100
Subject: [PATCH] idviews: Ignore host or hostgroup options set to None

Since passing --hosts= or --hostsgroups= to idview-apply or unapply
commands does not make sense, ignore it.

https://fedorahosted.org/freeipa/ticket/4806
---
 ipalib/plugins/idviews.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ipalib/plugins/idviews.py b/ipalib/plugins/idviews.py
index c9c1bd848750e7c7e1c472df179368ac2b9d29ce..df6b80fee6239c97e2133885234408c2816b3774 100644
--- a/ipalib/plugins/idviews.py
+++ b/ipalib/plugins/idviews.py
@@ -253,6 +253,12 @@ class baseidview_apply(LDAPQuery):
             'hostgroup': [],
             }
 
+        # Make sure we ignore None passed via host or hostgroup, since it does
+        # not make sense
+        for key in ('host', 'hostgroup'):
+            if key in options and options[key] is None:
+                del options[key]
+
         # Generate a list of all hosts to apply the view to
         hosts_to_apply = list(options.get('host', []))
 
-- 
1.9.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to