idviews: Complain if host is already assigned the ID View in idview-apply

When running a idview-apply command, the hosts that were already assigned
the desired view were silently ignored. Make sure such hosts show up in
the list of failed hosts.

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

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Tomas Babej authored and Petr Vobornik committed 2014-12-12 16:43:23 +01:00
1 parent 4b367bc9a7
commit fdd7b79eea
1 file changed
+5 -4
+5 -4
View File
@@ -260,7 +260,7 @@ class baseidview_apply(LDAPQuery):
try:
hosts_to_apply += get_complete_hostgroup_member_list(hostgroup)
except errors.NotFound:
failed['hostgroup'].append((hostgroup, "not found"))
failed['hostgroup'].append((hostgroup, unicode(_("not found"))))
except errors.PublicError as e:
failed['hostgroup'].append((hostgroup, "%s : %s" % (
e.__class__.__name__, str(e))))
@@ -279,10 +279,11 @@ class baseidview_apply(LDAPQuery):
completed = completed + 1
succeeded['host'].append(host)
except errors.EmptyModlist:
# If view was already applied, do not complain
pass
# If view was already applied, complain about it
failed['host'].append((host,
unicode(_("ID View already applied"))))
except errors.NotFound:
failed['host'].append((host, "not found"))
failed['host'].append((host, unicode(_("not found"))))
except errors.PublicError as e:
failed['host'].append((host, str(e)))