summaryrefslogtreecommitdiffstats
path: root/events
diff options
context:
space:
mode:
Diffstat (limited to 'events')
-rw-r--r--events/eventskeygen.py2
-rw-r--r--events/src/eventtypes.py2
-rw-r--r--events/src/handlers.py19
3 files changed, 23 insertions, 0 deletions
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 656a7dce9f1..f9bdb9fed52 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -25,6 +25,8 @@ keys = (
"EVENT_VOLUME_START",
"EVENT_VOLUME_STOP",
"EVENT_VOLUME_DELETE",
+ "EVENT_VOLUME_SET",
+ "EVENT_VOLUME_RESET",
)
LAST_EVENT = "EVENT_LAST"
diff --git a/events/src/eventtypes.py b/events/src/eventtypes.py
index 4812e659de3..b09e5bcff9a 100644
--- a/events/src/eventtypes.py
+++ b/events/src/eventtypes.py
@@ -6,4 +6,6 @@ all_events = [
"EVENT_VOLUME_START",
"EVENT_VOLUME_STOP",
"EVENT_VOLUME_DELETE",
+ "EVENT_VOLUME_SET",
+ "EVENT_VOLUME_RESET",
]
diff --git a/events/src/handlers.py b/events/src/handlers.py
index 9b756a91d51..21d3e83de54 100644
--- a/events/src/handlers.py
+++ b/events/src/handlers.py
@@ -19,3 +19,22 @@ def generic_handler(ts, key, data):
Ex: handle_event_volume_create(ts, key, data)
"""
utils.publish(ts, key, data)
+
+
+def handle_event_volume_set(ts, key, data):
+ """
+ Recieved data will have all the options as one string, split into
+ list of options. "key1,value1,key2,value2" into
+ [[key1, value1], [key2, value2]]
+ """
+ opts = data.get("options", "").strip(",").split(",")
+ data["options"] = []
+ for i, opt in enumerate(opts):
+ if i % 2 == 0:
+ # Add new array with key
+ data["options"].append([opt])
+ else:
+ # Add to the last added array
+ data["options"][-1].append(opt)
+
+ utils.publish(ts, key, data)