2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-04-13 12:21:30 +00:00

Merge branch 'master' into nodesearch

This commit is contained in:
Jarrod Johnson
2019-10-17 13:46:23 -04:00
2 changed files with 10 additions and 2 deletions

View File

@@ -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:

View File

@@ -23,6 +23,7 @@ import confluent.config.configmanager as cfm
import confluent.config.conf as cfgfile
from copy import deepcopy
from datetime import datetime
import confluent.util as util
import json
try:
@@ -59,7 +60,9 @@ def _htmlify_structure(indict):
if isinstance(indict, dict):
for key in sorted(indict):
ret += "<li>{0}: ".format(key)
if type(indict[key]) in (bytes, unicode, float, int):
if type(indict[key]) in (bytes, unicode):
ret += util.stringify(indict[key])
if type(indict[key]) in (float, int):
ret += str(indict[key])
elif isinstance(indict[key], datetime):
ret += indict[key].strftime('%Y-%m-%dT%H:%M:%S')