Merge "Replace deprecated LOG.warn with warning"
This commit is contained in:
commit
7680d384b8
@ -214,10 +214,10 @@ def list_partitions(device):
|
||||
for line in lines:
|
||||
match = _PARTED_PRINT_RE.match(line)
|
||||
if match is None:
|
||||
LOG.warn(_LW("Partition information from parted for device "
|
||||
"%(device)s does not match "
|
||||
"expected format: %(line)s"),
|
||||
dict(device=device, line=line))
|
||||
LOG.warning(_LW("Partition information from parted for device "
|
||||
"%(device)s does not match "
|
||||
"expected format: %(line)s"),
|
||||
dict(device=device, line=line))
|
||||
continue
|
||||
# Cast int fields to ints (some are floats and we round them down)
|
||||
groups = [int(float(x)) if i < 4 else x
|
||||
|
@ -476,8 +476,8 @@ def unlink_without_raise(path):
|
||||
if e.errno == errno.ENOENT:
|
||||
return
|
||||
else:
|
||||
LOG.warn(_LW("Failed to unlink %(path)s, error: %(e)s"),
|
||||
{'path': path, 'e': e})
|
||||
LOG.warning(_LW("Failed to unlink %(path)s, error: %(e)s"),
|
||||
{'path': path, 'e': e})
|
||||
|
||||
|
||||
def rmtree_without_raise(path):
|
||||
@ -485,8 +485,8 @@ def rmtree_without_raise(path):
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
except OSError as e:
|
||||
LOG.warn(_LW("Failed to remove dir %(path)s, error: %(e)s"),
|
||||
{'path': path, 'e': e})
|
||||
LOG.warning(_LW("Failed to remove dir %(path)s, error: %(e)s"),
|
||||
{'path': path, 'e': e})
|
||||
|
||||
|
||||
def write_to_file(path, contents):
|
||||
@ -501,9 +501,10 @@ def create_link_without_raise(source, link):
|
||||
if e.errno == errno.EEXIST:
|
||||
return
|
||||
else:
|
||||
LOG.warn(_LW("Failed to create symlink from %(source)s to %(link)s"
|
||||
", error: %(e)s"),
|
||||
{'source': source, 'link': link, 'e': e})
|
||||
LOG.warning(
|
||||
_LW("Failed to create symlink from %(source)s to %(link)s"
|
||||
", error: %(e)s"),
|
||||
{'source': source, 'link': link, 'e': e})
|
||||
|
||||
|
||||
def safe_rstrip(value, chars=None):
|
||||
@ -515,8 +516,9 @@ def safe_rstrip(value, chars=None):
|
||||
|
||||
"""
|
||||
if not isinstance(value, six.string_types):
|
||||
LOG.warn(_LW("Failed to remove trailing character. Returning original "
|
||||
"object. Supplied object is not a string: %s,"), value)
|
||||
LOG.warning(_LW("Failed to remove trailing character. Returning "
|
||||
"original object. Supplied object is not a string: "
|
||||
"%s,"), value)
|
||||
return value
|
||||
|
||||
return value.rstrip(chars) or value
|
||||
|
@ -286,9 +286,10 @@ class ConductorManager(periodic_task.PeriodicTasks):
|
||||
except exception.ConductorAlreadyRegistered:
|
||||
# This conductor was already registered and did not shut down
|
||||
# properly, so log a warning and update the record.
|
||||
LOG.warn(_LW("A conductor with hostname %(hostname)s "
|
||||
"was previously registered. Updating registration"),
|
||||
{'hostname': self.host})
|
||||
LOG.warning(
|
||||
_LW("A conductor with hostname %(hostname)s "
|
||||
"was previously registered. Updating registration"),
|
||||
{'hostname': self.host})
|
||||
cdr = self.dbapi.register_conductor({'hostname': self.host,
|
||||
'drivers': self.drivers},
|
||||
update_existing=True)
|
||||
@ -1789,27 +1790,27 @@ class ConductorManager(periodic_task.PeriodicTasks):
|
||||
sensors_data = task.driver.management.get_sensors_data(
|
||||
task)
|
||||
except NotImplementedError:
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
'get_sensors_data is not implemented for driver'
|
||||
' %(driver)s, node_uuid is %(node)s'),
|
||||
{'node': node_uuid, 'driver': driver})
|
||||
except exception.FailedToParseSensorData as fps:
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"During get_sensors_data, could not parse "
|
||||
"sensor data for node %(node)s. Error: %(err)s."),
|
||||
{'node': node_uuid, 'err': str(fps)})
|
||||
except exception.FailedToGetSensorData as fgs:
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"During get_sensors_data, could not get "
|
||||
"sensor data for node %(node)s. Error: %(err)s."),
|
||||
{'node': node_uuid, 'err': str(fgs)})
|
||||
except exception.NodeNotFound:
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"During send_sensor_data, node %(node)s was not "
|
||||
"found and presumed deleted by another process."),
|
||||
{'node': node_uuid})
|
||||
except Exception as e:
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
"Failed to get sensor data for node %(node)s. "
|
||||
"Error: %(error)s"), {'node': node_uuid, 'error': str(e)})
|
||||
else:
|
||||
|
@ -89,15 +89,15 @@ def node_power_action(task, new_state):
|
||||
node['power_state'] = new_state
|
||||
node['target_power_state'] = states.NOSTATE
|
||||
node.save()
|
||||
LOG.warn(_LW("Not going to change node power state because "
|
||||
"current state = requested state = '%(state)s'."),
|
||||
{'state': curr_state})
|
||||
LOG.warning(_LW("Not going to change node power state because "
|
||||
"current state = requested state = '%(state)s'."),
|
||||
{'state': curr_state})
|
||||
return
|
||||
|
||||
if curr_state == states.ERROR:
|
||||
# be optimistic and continue action
|
||||
LOG.warn(_LW("Driver returns ERROR power state for node %s."),
|
||||
node.uuid)
|
||||
LOG.warning(_LW("Driver returns ERROR power state for node %s."),
|
||||
node.uuid)
|
||||
|
||||
# Set the target_power_state and clear any last_error, if we're
|
||||
# starting a new operation. This will expose to other processes
|
||||
|
@ -578,8 +578,9 @@ class Connection(api.Connection):
|
||||
|
||||
if nodes:
|
||||
nodes = ', '.join(nodes)
|
||||
LOG.warn(_LW('Cleared reservations held by %(hostname)s: '
|
||||
'%(nodes)s'), {'hostname': hostname, 'nodes': nodes})
|
||||
LOG.warning(
|
||||
_LW('Cleared reservations held by %(hostname)s: '
|
||||
'%(nodes)s'), {'hostname': hostname, 'nodes': nodes})
|
||||
|
||||
def get_active_driver_dict(self, interval=None):
|
||||
if interval is None:
|
||||
|
@ -279,10 +279,10 @@ class NeutronDHCPApi(base.BaseDHCP):
|
||||
failures.append(port.uuid)
|
||||
|
||||
if failures:
|
||||
LOG.warn(_LW("Some errors were encountered on node %(node)s"
|
||||
" while retrieving IP address on the following"
|
||||
" ports: %(ports)s."),
|
||||
{'node': task.node.uuid, 'ports': failures})
|
||||
LOG.warning(_LW("Some errors were encountered on node %(node)s"
|
||||
" while retrieving IP address on the following"
|
||||
" ports: %(ports)s."),
|
||||
{'node': task.node.uuid, 'ports': failures})
|
||||
|
||||
return ip_addresses
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ def driver_periodic_task(parallel=True, **other):
|
||||
|
||||
eventlet.greenthread.spawn_n(_internal)
|
||||
else:
|
||||
LOG.warn(_LW(
|
||||
LOG.warning(_LW(
|
||||
'Using periodic tasks with parallel=False is deprecated, '
|
||||
'"parallel" argument will be ignored starting with '
|
||||
'the Mitaka release'))
|
||||
|
@ -356,8 +356,8 @@ def set_config(task, **kwargs):
|
||||
attrib_names.append(k)
|
||||
|
||||
if unchanged_attribs:
|
||||
LOG.warn(_LW('Ignoring unchanged BIOS settings %r'),
|
||||
unchanged_attribs)
|
||||
LOG.warning(_LW('Ignoring unchanged BIOS settings %r'),
|
||||
unchanged_attribs)
|
||||
|
||||
if invalid_attribs_msgs or read_only_keys:
|
||||
raise exception.DracOperationFailed(
|
||||
|
@ -447,8 +447,8 @@ def _disable_secure_boot_if_supported(task):
|
||||
# attempted deploy. Handling this exception here, will help the
|
||||
# user to tear down such a Node.
|
||||
except exception.IloOperationNotSupported:
|
||||
LOG.warn(_LW('Secure boot mode is not supported for node %s'),
|
||||
task.node.uuid)
|
||||
LOG.warning(_LW('Secure boot mode is not supported for node %s'),
|
||||
task.node.uuid)
|
||||
|
||||
|
||||
class IloVirtualMediaIscsiDeploy(base.DeployInterface):
|
||||
|
@ -56,9 +56,9 @@ def _create_ports_if_not_exist(node, macs):
|
||||
LOG.info(_LI("Port created for MAC address %(address)s for node "
|
||||
"%(node)s"), {'address': mac, 'node': node.uuid})
|
||||
except exception.MACAlreadyExists:
|
||||
LOG.warn(_LW("Port already exists for MAC address %(address)s "
|
||||
"for node %(node)s"),
|
||||
{'address': mac, 'node': node.uuid})
|
||||
LOG.warning(_LW("Port already exists for MAC address %(address)s "
|
||||
"for node %(node)s"),
|
||||
{'address': mac, 'node': node.uuid})
|
||||
|
||||
|
||||
def _get_essential_properties(node, ilo_object):
|
||||
|
@ -98,9 +98,9 @@ def _execute_ilo_clean_step(node, step, *args, **kwargs):
|
||||
except ilo_error.IloCommandNotSupportedError:
|
||||
# This clean step is not supported on Gen8 and below servers.
|
||||
# Log the failure and continue with cleaning.
|
||||
LOG.warn(_LW("'%(step)s' clean step is not supported on node "
|
||||
"%(uuid)s. Skipping the clean step."),
|
||||
{'step': step, 'uuid': node.uuid})
|
||||
LOG.warning(_LW("'%(step)s' clean step is not supported on node "
|
||||
"%(uuid)s. Skipping the clean step."),
|
||||
{'step': step, 'uuid': node.uuid})
|
||||
except ilo_error.IloError as ilo_exception:
|
||||
raise exception.NodeCleaningFailure(_(
|
||||
"Clean step %(step)s failed "
|
||||
|
@ -201,10 +201,11 @@ class ImageCache(object):
|
||||
return
|
||||
amount = self._clean_up_ensure_cache_size(survived, amount)
|
||||
if amount is not None and amount > 0:
|
||||
LOG.warn(_LW("Cache clean up was unable to reclaim %(required)d "
|
||||
"MiB of disk space, still %(left)d MiB required"),
|
||||
{'required': amount_copy / 1024 / 1024,
|
||||
'left': amount / 1024 / 1024})
|
||||
LOG.warning(
|
||||
_LW("Cache clean up was unable to reclaim %(required)d "
|
||||
"MiB of disk space, still %(left)d MiB required"),
|
||||
{'required': amount_copy / 1024 / 1024,
|
||||
'left': amount / 1024 / 1024})
|
||||
|
||||
def _clean_up_too_old(self, listing, amount):
|
||||
"""Clean up stage 1: drop images that are older than TTL.
|
||||
@ -228,9 +229,9 @@ class ImageCache(object):
|
||||
try:
|
||||
os.unlink(file_name)
|
||||
except EnvironmentError as exc:
|
||||
LOG.warn(_LW("Unable to delete file %(name)s from "
|
||||
"master image cache: %(exc)s"),
|
||||
{'name': file_name, 'exc': exc})
|
||||
LOG.warning(_LW("Unable to delete file %(name)s from "
|
||||
"master image cache: %(exc)s"),
|
||||
{'name': file_name, 'exc': exc})
|
||||
else:
|
||||
if amount is not None:
|
||||
amount -= stat.st_size
|
||||
@ -267,9 +268,9 @@ class ImageCache(object):
|
||||
try:
|
||||
os.unlink(file_name)
|
||||
except EnvironmentError as exc:
|
||||
LOG.warn(_LW("Unable to delete file %(name)s from "
|
||||
"master image cache: %(exc)s"),
|
||||
{'name': file_name, 'exc': exc})
|
||||
LOG.warning(_LW("Unable to delete file %(name)s from "
|
||||
"master image cache: %(exc)s"),
|
||||
{'name': file_name, 'exc': exc})
|
||||
else:
|
||||
total_size -= stat.st_size
|
||||
if amount is not None:
|
||||
@ -402,9 +403,9 @@ def _delete_master_path_if_stale(master_path, href, ctx):
|
||||
if not img_mtime:
|
||||
# This means that href is not a glance image and doesn't have an
|
||||
# updated_at attribute
|
||||
LOG.warn(_LW("Image service couldn't determine last "
|
||||
"modification time of %(href)s, considering "
|
||||
"cached image up to date."), {'href': href})
|
||||
LOG.warning(_LW("Image service couldn't determine last "
|
||||
"modification time of %(href)s, considering "
|
||||
"cached image up to date."), {'href': href})
|
||||
return True
|
||||
master_mtime = utils.unix_file_modification_datetime(master_path)
|
||||
if img_mtime <= master_mtime:
|
||||
|
@ -134,10 +134,11 @@ def _get_pxe_conf_option(task, opt_name):
|
||||
CONF.pybasedir)
|
||||
|
||||
if current_value != default_value:
|
||||
LOG.warn(_LW("The CONF option [agent]agent_%(opt_name)s is "
|
||||
"deprecated and will be removed in Mitaka release of "
|
||||
"Ironic. Please use [pxe]%(opt_name)s instead."),
|
||||
{'opt_name': opt_name})
|
||||
LOG.warning(
|
||||
_LW("The CONF option [agent]agent_%(opt_name)s is "
|
||||
"deprecated and will be removed in Mitaka release of "
|
||||
"Ironic. Please use [pxe]%(opt_name)s instead."),
|
||||
{'opt_name': opt_name})
|
||||
return current_value
|
||||
|
||||
# Either task.driver.deploy is ISCSIDeploy() or the default value hasn't
|
||||
@ -541,16 +542,18 @@ class PXEBoot(base.BootInterface):
|
||||
]
|
||||
except KeyError:
|
||||
if not iwdi:
|
||||
LOG.warn(_LW("The UUID for the root partition can't be "
|
||||
"found, unable to switch the pxe config from "
|
||||
"deployment mode to service (boot) mode for "
|
||||
"node %(node)s"), {"node": task.node.uuid})
|
||||
LOG.warning(
|
||||
_LW("The UUID for the root partition can't be "
|
||||
"found, unable to switch the pxe config from "
|
||||
"deployment mode to service (boot) mode for "
|
||||
"node %(node)s"), {"node": task.node.uuid})
|
||||
else:
|
||||
LOG.warn(_LW("The disk id for the whole disk image can't "
|
||||
"be found, unable to switch the pxe config "
|
||||
"from deployment mode to service (boot) mode "
|
||||
"for node %(node)s"),
|
||||
{"node": task.node.uuid})
|
||||
LOG.warning(
|
||||
_LW("The disk id for the whole disk image can't "
|
||||
"be found, unable to switch the pxe config "
|
||||
"from deployment mode to service (boot) mode "
|
||||
"for node %(node)s"),
|
||||
{"node": task.node.uuid})
|
||||
else:
|
||||
pxe_config_path = pxe_utils.get_pxe_config_file_path(
|
||||
task.node.uuid)
|
||||
|
@ -143,8 +143,8 @@ def get_node_capability(node, capability):
|
||||
if parts[0].strip() == capability:
|
||||
return parts[1].strip()
|
||||
else:
|
||||
LOG.warn(_LW("Ignoring malformed capability '%s'. "
|
||||
"Format should be 'key:val'."), node_capability)
|
||||
LOG.warning(_LW("Ignoring malformed capability '%s'. "
|
||||
"Format should be 'key:val'."), node_capability)
|
||||
|
||||
|
||||
def add_node_capability(task, capability, value):
|
||||
|
@ -186,7 +186,7 @@ BYT;
|
||||
'parted', '-s', '-m', '/dev/fake', 'unit', 'MiB', 'print',
|
||||
use_standard_locale=True, run_as_root=True)
|
||||
|
||||
@mock.patch.object(disk_partitioner.LOG, 'warn', autospec=True)
|
||||
@mock.patch.object(disk_partitioner.LOG, 'warning', autospec=True)
|
||||
def test_incorrect(self, log_mock, execute_mock):
|
||||
output = """
|
||||
BYT;
|
||||
|
@ -843,7 +843,8 @@ class IloVirtualMediaIscsiDeployTestCase(db_base.DbTestCase):
|
||||
self.assertNotIn('boot_iso_created_in_web_server', dinfo)
|
||||
self.assertNotIn('root_uuid_or_disk_id', dinfo)
|
||||
|
||||
@mock.patch.object(ilo_deploy.LOG, 'warn', spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy.LOG, 'warning',
|
||||
spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy, 'exception', spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy, '_update_secure_boot_mode', spec_set=True,
|
||||
autospec=True)
|
||||
@ -987,7 +988,8 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase):
|
||||
update_secure_boot_mode_mock.assert_called_once_with(task, False)
|
||||
self.assertEqual(states.DELETED, returned_state)
|
||||
|
||||
@mock.patch.object(ilo_deploy.LOG, 'warn', spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy.LOG, 'warning',
|
||||
spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy, 'exception', spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy, '_update_secure_boot_mode', spec_set=True,
|
||||
autospec=True)
|
||||
@ -1730,7 +1732,8 @@ class IloPXEDeployTestCase(db_base.DbTestCase):
|
||||
pxe_tear_down_mock.assert_called_once_with(mock.ANY, task)
|
||||
self.assertEqual(states.DELETED, returned_state)
|
||||
|
||||
@mock.patch.object(ilo_deploy.LOG, 'warn', spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy.LOG, 'warning',
|
||||
spec_set=True, autospec=True)
|
||||
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'tear_down',
|
||||
spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_deploy, 'exception', spec_set=True, autospec=True)
|
||||
|
@ -243,7 +243,8 @@ class TestInspectPrivateMethods(db_base.DbTestCase):
|
||||
db_obj.create_port.assert_any_call(port_dict1)
|
||||
db_obj.create_port.assert_any_call(port_dict2)
|
||||
|
||||
@mock.patch.object(ilo_inspect.LOG, 'warn', spec_set=True, autospec=True)
|
||||
@mock.patch.object(ilo_inspect.LOG, 'warning',
|
||||
spec_set=True, autospec=True)
|
||||
@mock.patch.object(dbapi, 'get_instance', spec_set=True, autospec=True)
|
||||
def test__create_ports_if_not_exist_mac_exception(self,
|
||||
instance_mock,
|
||||
|
@ -220,7 +220,7 @@ class IloManagementTestCase(db_base.DbTestCase):
|
||||
ilo_management._execute_ilo_clean_step(
|
||||
self.node, 'fake-step', 'args', kwarg='kwarg')
|
||||
clean_step_mock.assert_called_once_with('args', kwarg='kwarg')
|
||||
self.assertTrue(log_mock.warn.called)
|
||||
self.assertTrue(log_mock.warning.called)
|
||||
|
||||
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
|
||||
autospec=True)
|
||||
|
@ -469,7 +469,7 @@ class TestImageCacheCleanUp(base.TestCase):
|
||||
'uuid', 'fake', 'fake')
|
||||
self.assertTrue(mock_rmtree.called)
|
||||
|
||||
@mock.patch.object(image_cache.LOG, 'warn', autospec=True)
|
||||
@mock.patch.object(image_cache.LOG, 'warning', autospec=True)
|
||||
@mock.patch.object(image_cache.ImageCache, '_clean_up_too_old',
|
||||
autospec=True)
|
||||
@mock.patch.object(image_cache.ImageCache, '_clean_up_ensure_cache_size',
|
||||
|
Loading…
x
Reference in New Issue
Block a user