Use LOG.warning instead of deprecated LOG.warn
The LOG.warn method is deprecated[1] and the LOG.warning method should be used instead. [1] https://docs.python.org/3/library/logging.html#logging.warning Change-Id: I9037d4dfc680586ec5aa14d6f57e12dbdc4a4b91
This commit is contained in:
parent
c01a7a74f0
commit
2c2bb5e6c1
@ -167,7 +167,8 @@ class BaseOpenStackService(base.BaseMetadataService):
|
||||
for service_data in services_data:
|
||||
service_type = service_data.get("type")
|
||||
if service_type != NETWORK_SERVICE_TYPE_DNS:
|
||||
LOG.warn("Skipping unsupported service type: %s", service_type)
|
||||
LOG.warning("Skipping unsupported service type: %s",
|
||||
service_type)
|
||||
continue
|
||||
|
||||
address = service_data.get("address")
|
||||
|
@ -140,7 +140,7 @@ class NetworkConfigPlugin(plugin_base.BasePlugin):
|
||||
for mac in adapter_macs:
|
||||
nic = macnics.pop(mac, None)
|
||||
if not nic:
|
||||
LOG.warn("Missing details for adapter %s", mac)
|
||||
LOG.warning("Missing details for adapter %s", mac)
|
||||
continue
|
||||
|
||||
name = osutils.get_network_adapter_name_by_mac_address(mac)
|
||||
@ -168,7 +168,7 @@ class NetworkConfigPlugin(plugin_base.BasePlugin):
|
||||
reboot_required = reboot or reboot_required
|
||||
configured = True
|
||||
for mac in macnics:
|
||||
LOG.warn("Details not used for adapter %s", mac)
|
||||
LOG.warning("Details not used for adapter %s", mac)
|
||||
if not configured:
|
||||
LOG.error("No adapters were configured")
|
||||
|
||||
|
@ -40,8 +40,8 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
||||
|
||||
if password:
|
||||
injected = True
|
||||
LOG.warn('Using admin_pass metadata user password. Consider '
|
||||
'changing it as soon as possible')
|
||||
LOG.warning('Using admin_pass metadata user password. Consider '
|
||||
'changing it as soon as possible')
|
||||
else:
|
||||
password = shared_data.get(plugin_constant.SHARED_DATA_PASSWORD)
|
||||
|
||||
|
@ -59,9 +59,9 @@ def load_plugins(stage):
|
||||
for class_path in CONF.plugins:
|
||||
if class_path in OLD_PLUGINS:
|
||||
new_class_path = OLD_PLUGINS[class_path]
|
||||
LOG.warn("Old plugin module %r was found. The new name is %r. "
|
||||
"The old name will not be supported starting with "
|
||||
"cloudbaseinit 1.0", class_path, new_class_path)
|
||||
LOG.warning("Old plugin module %r was found. The new name is %r. "
|
||||
"The old name will not be supported starting with "
|
||||
"cloudbaseinit 1.0", class_path, new_class_path)
|
||||
class_path = new_class_path
|
||||
|
||||
try:
|
||||
|
@ -241,8 +241,8 @@ class AzureGuestAgentPlugin(base.BasePlugin):
|
||||
self._configure_rd_agent(osutils, ga_target_path)
|
||||
|
||||
if not osutils.check_dotnet_is_installed("4"):
|
||||
LOG.warn("The .Net framework 4.5 or greater is required "
|
||||
"by the Azure guest agent")
|
||||
LOG.warning("The .Net framework 4.5 or greater is "
|
||||
"required by the Azure guest agent")
|
||||
else:
|
||||
osutils.set_service_start_mode(
|
||||
SERVICE_NAME_RDAGENT,
|
||||
|
@ -34,8 +34,8 @@ class ConfigWinRMListenerPlugin(base.BasePlugin):
|
||||
|
||||
def _check_winrm_service(self, osutils):
|
||||
if not osutils.check_service_exists(self._winrm_service_name):
|
||||
LOG.warn("Cannot configure the WinRM listener as the service "
|
||||
"is not available")
|
||||
LOG.warning("Cannot configure the WinRM listener as the service "
|
||||
"is not available")
|
||||
return False
|
||||
|
||||
start_mode = osutils.get_service_start_mode(self._winrm_service_name)
|
||||
|
@ -84,7 +84,7 @@ class LogSnatcher(object):
|
||||
with LogSnatcher('plugins.windows.createuser') as snatcher:
|
||||
LOG.info("doing stuff")
|
||||
LOG.info("doing stuff %s", 1)
|
||||
LOG.warn("doing other stuff")
|
||||
LOG.warning("doing other stuff")
|
||||
...
|
||||
self.assertEqual(snatcher.output,
|
||||
['INFO:unknown:doing stuff',
|
||||
|
@ -45,11 +45,11 @@ def set_hostname(osutils, hostname):
|
||||
hostname = hostname.split('.', 1)[0]
|
||||
if (len(hostname) > NETBIOS_HOST_NAME_MAX_LEN and
|
||||
CONF.netbios_host_name_compatibility):
|
||||
LOG.warn('Truncating host name for Netbios compatibility. '
|
||||
'Old name: %(old_hostname)s, new name: '
|
||||
'%(new_hostname)s' %
|
||||
{'old_hostname': hostname,
|
||||
'new_hostname': hostname[:NETBIOS_HOST_NAME_MAX_LEN]})
|
||||
LOG.warning('Truncating host name for Netbios compatibility. '
|
||||
'Old name: %(old_hostname)s, new name: '
|
||||
'%(new_hostname)s' %
|
||||
{'old_hostname': hostname,
|
||||
'new_hostname': hostname[:NETBIOS_HOST_NAME_MAX_LEN]})
|
||||
hostname = hostname[:NETBIOS_HOST_NAME_MAX_LEN]
|
||||
hostname = re.sub(r'-$', '0', hostname)
|
||||
if platform.node().lower() == hostname.lower():
|
||||
|
@ -101,5 +101,5 @@ def setup(product_name):
|
||||
formatters.ContextFormatter(project=product_name,
|
||||
datefmt=datefmt))
|
||||
except serial.SerialException:
|
||||
LOG.warn("Serial port: {0} could not be opened".format(
|
||||
CONF.logging_serial_port_settings))
|
||||
LOG.warning("Serial port: {0} could not be opened".format(
|
||||
CONF.logging_serial_port_settings))
|
||||
|
Loading…
x
Reference in New Issue
Block a user