From 7a2e1a248aebcfa7293a0ba2272debf879483371 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Mon, 25 Jul 2016 11:32:05 +0800 Subject: [PATCH] Combine multiple warning logs into one in create_ports Change-Id: Icb2b000ce3f0f5db89e90c05cf1bc42e511fd36d --- ironic_inspector/node_cache.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 2b1737597..2be0709f8 100644 --- a/ironic_inspector/node_cache.py +++ b/ironic_inspector/node_cache.py @@ -227,12 +227,15 @@ class NodeInfo(object): A warning is issued if port already exists on a node. """ + existing_macs = [] for mac in macs: if mac not in self.ports(): self._create_port(mac) else: - LOG.warning(_LW('Port %s already exists, skipping'), - mac, node_info=self) + existing_macs.append(mac) + if existing_macs: + LOG.warning(_LW('Did not create ports %s as they already exist'), + existing_macs, node_info=self) def ports(self): """Get Ironic port objects associated with the cached node record.