From 186e89cd871a37bdeb8735ce24033beb6d1acce4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 17 Oct 2019 09:47:46 -0400 Subject: [PATCH] Fix handling autosense with python3 --- confluent_server/confluent/discovery/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index fe3f5dc4..c8b349f1 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -91,6 +91,11 @@ import eventlet.semaphore autosensors = set() scanner = None +try: + unicode +except NameError: + unicode = str + class nesteddict(dict): def __missing__(self, key): @@ -371,7 +376,7 @@ def handle_autosense_config(operation, inputdata): yield msg.KeyValueData({'enabled': autosense}) elif operation == 'update': enabled = inputdata['enabled'] - if type(enabled) in (unicode, str): + if type(enabled) in (unicode, bytes): enabled = enabled.lower() in ('true', '1', 'y', 'yes', 'enable', 'enabled') if autosense == enabled: