From 12f6969ec9daafe7926a49a6775501d1034694f4 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Dec 12 2014 15:43:23 +0000 Subject: 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 Reviewed-By: Petr Vobornik --- diff --git a/ipalib/plugins/idviews.py b/ipalib/plugins/idviews.py index 9c87210..c9c1bd8 100644 --- a/ipalib/plugins/idviews.py +++ b/ipalib/plugins/idviews.py @@ -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)))