Change deprecated warn() to warning()

pull/8/head
Stein Magnus Jodal 2017-07-26 14:06:02 +02:00
rodzic 8b1aa60587
commit a89e744a47
5 zmienionych plików z 19 dodań i 19 usunięć

Wyświetl plik

@ -217,7 +217,7 @@ class Broker:
self.transitions.start()
self.logger.debug("Broker starting")
except MachineError as me:
self.logger.warn("[WARN-0001] Invalid method call at this moment: %s" % me)
self.logger.warning("[WARN-0001] Invalid method call at this moment: %s" % me)
raise BrokerException("Broker instance can't be started: %s" % me)
yield from self.plugins_manager.fire_event(EVENT_BROKER_PRE_START)
@ -350,7 +350,7 @@ class Broker:
try:
handler, client_session = yield from BrokerProtocolHandler.init_from_connect(reader, writer, self.plugins_manager, loop=self._loop)
except HBMQTTException as exc:
self.logger.warn("[MQTT-3.1.0-1] %s: Can't read first packet an CONNECT: %s" %
self.logger.warning("[MQTT-3.1.0-1] %s: Can't read first packet an CONNECT: %s" %
(format_client_message(address=remote_address, port=remote_port), exc))
#yield from writer.close()
self.logger.debug("Connection closed")
@ -474,10 +474,10 @@ class Broker:
self.logger.debug("%s handling message delivery" % client_session.client_id)
app_message = wait_deliver.result()
if not app_message.topic:
self.logger.warn("[MQTT-4.7.3-1] - %s invalid TOPIC sent in PUBLISH message, closing connection" % client_session.client_id)
self.logger.warning("[MQTT-4.7.3-1] - %s invalid TOPIC sent in PUBLISH message, closing connection" % client_session.client_id)
break
if "#" in app_message.topic or "+" in app_message.topic:
self.logger.warn("[MQTT-3.3.2-2] - %s invalid TOPIC sent in PUBLISH message, closing connection" % client_session.client_id)
self.logger.warning("[MQTT-3.3.2-2] - %s invalid TOPIC sent in PUBLISH message, closing connection" % client_session.client_id)
break
yield from self.plugins_manager.fire_event(EVENT_BROKER_MESSAGE_RECEIVED,
client_id=client_session.client_id,

Wyświetl plik

@ -167,7 +167,7 @@ class MQTTClient:
yield from self._handler.stop()
self.session.transitions.disconnect()
else:
self.logger.warn("Client session is not currently connected, ignoring call")
self.logger.warning("Client session is not currently connected, ignoring call")
@asyncio.coroutine
def reconnect(self, cleansession=None):
@ -185,7 +185,7 @@ class MQTTClient:
"""
if self.session.transitions.is_connected():
self.logger.warn("Client already connected")
self.logger.warning("Client already connected")
return CONNECTION_ACCEPTED
if cleansession:
@ -231,7 +231,7 @@ class MQTTClient:
if self.session.transitions.is_connected():
yield from self._handler.mqtt_ping()
else:
self.logger.warn("MQTT PING request incompatible with current session state '%s'" %
self.logger.warning("MQTT PING request incompatible with current session state '%s'" %
self.session.transitions.state)
@mqtt_connected
@ -366,7 +366,7 @@ class MQTTClient:
if secure:
if self.session.cafile is None or self.session.cafile == '':
self.logger.warn("TLS connection can't be estabilshed, no certificate file (.cert) given")
self.logger.warning("TLS connection can't be estabilshed, no certificate file (.cert) given")
raise ClientException("TLS connection can't be estabilshed, no certificate file (.cert) given")
sc = ssl.create_default_context(
ssl.Purpose.SERVER_AUTH,
@ -416,15 +416,15 @@ class MQTTClient:
self.logger.debug("connected to %s:%s" % (self.session.remote_address, self.session.remote_port))
return return_code
except InvalidURI as iuri:
self.logger.warn("connection failed: invalid URI '%s'" % self.session.broker_uri)
self.logger.warning("connection failed: invalid URI '%s'" % self.session.broker_uri)
self.session.transitions.disconnect()
raise ConnectException("connection failed: invalid URI '%s'" % self.session.broker_uri, iuri)
except InvalidHandshake as ihs:
self.logger.warn("connection failed: invalid websocket handshake")
self.logger.warning("connection failed: invalid websocket handshake")
self.session.transitions.disconnect()
raise ConnectException("connection failed: invalid websocket handshake", ihs)
except (ProtocolHandlerException, ConnectionError, OSError) as e:
self.logger.warn("MQTT connection failed: %r" % e)
self.logger.warning("MQTT connection failed: %r" % e)
self.session.transitions.disconnect()
raise ConnectException(e)

Wyświetl plik

@ -12,12 +12,12 @@ class BaseAuthPlugin:
try:
self.auth_config = self.context.config['auth']
except KeyError:
self.context.logger.warn("'auth' section not found in context configuration")
self.context.logger.warning("'auth' section not found in context configuration")
def authenticate(self, *args, **kwargs):
if not self.auth_config:
# auth config section not found
self.context.logger.warn("'auth' section not found in context configuration")
self.context.logger.warning("'auth' section not found in context configuration")
return False
return True
@ -44,7 +44,7 @@ class AnonymousAuthPlugin(BaseAuthPlugin):
else:
self.context.logger.debug("Authentication failure: session has an empty username")
except KeyError:
self.context.logger.warn("Session informations not available")
self.context.logger.warning("Session informations not available")
authenticated = False
return authenticated
@ -70,7 +70,7 @@ class FileAuthPlugin(BaseAuthPlugin):
self.context.logger.debug("user %s , hash=%s" % (username, pwd_hash))
self.context.logger.debug("%d user(s) read from file %s" % (len(self._users), password_file))
except FileNotFoundError:
self.context.logger.warn("Password file %s not found" % password_file)
self.context.logger.warning("Password file %s not found" % password_file)
else:
self.context.logger.debug("Configuration parameter 'password_file' not found")

Wyświetl plik

@ -77,9 +77,9 @@ class PluginManager:
obj = plugin(plugin_context)
return Plugin(ep.name, ep, obj)
except ImportError as ie:
self.logger.warn("Plugin %r import failed: %s" % (ep, ie))
self.logger.warning("Plugin %r import failed: %s" % (ep, ie))
except pkg_resources.UnknownExtra as ue:
self.logger.warn("Plugin %r dependencies resolution failed: %s" % (ep, ue))
self.logger.warning("Plugin %r dependencies resolution failed: %s" % (ep, ue))
def get_plugin(self, name):
"""

Wyświetl plik

@ -16,12 +16,12 @@ class SQLitePlugin:
self.persistence_config = self.context.config['persistence']
self.init_db()
except KeyError:
self.context.logger.warn("'persistence' section not found in context configuration")
self.context.logger.warning("'persistence' section not found in context configuration")
def init_db(self):
self.db_file = self.persistence_config.get('file', None)
if not self.db_file:
self.context.logger.warn("'file' persistence parameter not found")
self.context.logger.warning("'file' persistence parameter not found")
else:
try:
self.conn = sqlite3.connect(self.db_file)