Eliminate duplicate exception messages for non-requested only_if_needed labels.  Need to use distinct() on the query since we're doing joins.



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2451 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index ea70970..ad0080f 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -184,7 +184,7 @@
     labels_not_requested = labels_not_requested.exclude(
         name__in=job_dependencies)
     errors = []
-    for label in labels_not_requested:
+    for label in labels_not_requested.distinct():
         hosts_in_label = hosts_in_job.filter(labels=label)
         errors.append('Cannot use hosts with label "%s" unless requested: %s' %
                       (label.name,