From bcd8d5dfa0696257d7fc8032da9dc8b4c890cca8 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Thu, 22 Oct 2015 14:12:03 +0800 Subject: [PATCH] Replace deprecated LOG.warn with LOG.warning Closes-Bug: #1508442 Change-Id: Ifcc2004f3274808d868c9947ed2b0b484f815daa --- ironic_inspector/firewall.py | 4 ++-- ironic_inspector/node_cache.py | 15 +++++++++------ ironic_inspector/plugins/standard.py | 7 ++++--- ironic_inspector/process.py | 4 ++-- ironic_inspector/utils.py | 5 +++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ironic_inspector/firewall.py b/ironic_inspector/firewall.py index f41057400..d2cfb9135 100644 --- a/ironic_inspector/firewall.py +++ b/ironic_inspector/firewall.py @@ -71,8 +71,8 @@ def init(): subprocess.check_call(BASE_COMMAND + ('-w', '-h'), stderr=null, stdout=null) except subprocess.CalledProcessError: - LOG.warn(_LW('iptables does not support -w flag, please update ' - 'it to at least version 1.4.21')) + LOG.warning(_LW('iptables does not support -w flag, please update ' + 'it to at least version 1.4.21')) else: BASE_COMMAND += ('-w',) diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 323db9a08..671de7c35 100644 --- a/ironic_inspector/node_cache.py +++ b/ironic_inspector/node_cache.py @@ -165,8 +165,9 @@ class NodeInfo(object): if mac not in self.ports(): self._create_port(mac) else: - LOG.warn(_LW('Port %(mac)s already exists for node %(uuid)s, ' - 'skipping'), {'mac': mac, 'uuid': self.uuid}) + LOG.warning( + _LW('Port %(mac)s already exists for node %(uuid)s, ' + 'skipping'), {'mac': mac, 'uuid': self.uuid}) def ports(self): """Get Ironic port objects associated with the cached node record. @@ -184,8 +185,9 @@ class NodeInfo(object): try: port = self.ironic.port.create(node_uuid=self.uuid, address=mac) except exceptions.Conflict: - LOG.warn(_LW('Port %(mac)s already exists for node %(uuid)s, ' - 'skipping'), {'mac': mac, 'uuid': self.uuid}) + LOG.warning( + _LW('Port %(mac)s already exists for node %(uuid)s, ' + 'skipping'), {'mac': mac, 'uuid': self.uuid}) # NOTE(dtantsur): we didn't get port object back, so we have to # reload ports on next access self._ports = None @@ -328,8 +330,9 @@ def delete_nodes_not_in_list(uuids): """ inspector_uuids = _list_node_uuids() for uuid in inspector_uuids - uuids: - LOG.warn(_LW('Node %s was deleted from Ironic, dropping from Ironic ' - 'Inspector database'), uuid) + LOG.warning( + _LW('Node %s was deleted from Ironic, dropping from Ironic ' + 'Inspector database'), uuid) _delete_node(uuid) diff --git a/ironic_inspector/plugins/standard.py b/ironic_inspector/plugins/standard.py index c5a64877a..76d0f68cf 100644 --- a/ironic_inspector/plugins/standard.py +++ b/ironic_inspector/plugins/standard.py @@ -231,9 +231,10 @@ class RamdiskErrorHook(base.ProcessingHook): def _store_logs(self, logs, introspection_data): if not CONF.processing.ramdisk_logs_dir: - LOG.warn(_LW('Failed to store logs received from the ramdisk ' - 'because ramdisk_logs_dir configuration option ' - 'is not set')) + LOG.warning( + _LW('Failed to store logs received from the ramdisk ' + 'because ramdisk_logs_dir configuration option ' + 'is not set')) return if not os.path.exists(CONF.processing.ramdisk_logs_dir): diff --git a/ironic_inspector/process.py b/ironic_inspector/process.py index c121ba586..97527d68b 100644 --- a/ironic_inspector/process.py +++ b/ironic_inspector/process.py @@ -131,11 +131,11 @@ def _run_post_hooks(node_info, introspection_data): node_patches=node_patches, ports_patches=ports_patches) if node_patches: - LOG.warn(_LW('Using node_patches is deprecated')) + LOG.warning(_LW('Using node_patches is deprecated')) node_info.patch(node_patches) if ports_patches: - LOG.warn(_LW('Using ports_patches is deprecated')) + LOG.warning(_LW('Using ports_patches is deprecated')) for mac, patches in ports_patches.items(): node_info.patch_port(mac, patches) diff --git a/ironic_inspector/utils.py b/ironic_inspector/utils.py index 181c61b11..eccc5fada 100644 --- a/ironic_inspector/utils.py +++ b/ironic_inspector/utils.py @@ -174,8 +174,9 @@ def get_ipmi_address(node): def check_provision_state(node, with_credentials=False): if node.maintenance: - LOG.warn(_LW('Introspecting nodes in maintenance mode is deprecated, ' - 'accepted states: %s'), VALID_STATES) + LOG.warning( + _LW('Introspecting nodes in maintenance mode is deprecated, ' + 'accepted states: %s'), VALID_STATES) return state = node.provision_state.lower()