Archived
Fix keys with . for Elasticsearch 2.0
This commit is contained in:
1 parent
1be03569fa
commit
099e07ea67
1 file changed
+6
-3
+6
-3
@@ -9,7 +9,9 @@ import requests
|
||||
|
||||
import settings
|
||||
|
||||
def to_python(status):
|
||||
|
||||
def to_python(raw_status):
|
||||
status = OrderedDict()
|
||||
integer_fields = [
|
||||
"driver.parameter.pollinterval",
|
||||
"ups.delay.shutdown",
|
||||
@@ -26,13 +28,14 @@ def to_python(status):
|
||||
"output.voltage",
|
||||
"ups.temperature"
|
||||
]
|
||||
for k,v in status.items():
|
||||
for k,v in raw_status.items():
|
||||
if k in integer_fields:
|
||||
v = int(v)
|
||||
elif k in float_fields:
|
||||
v = float(v)
|
||||
|
||||
status[k] = v
|
||||
allowed_key = k.replace('.', '_')
|
||||
status[allowed_key] = v
|
||||
|
||||
return status
|
||||
|
||||
|
||||
Reference in new issue
Block a user