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