Minor changes in monitoring protocol
authorNikos Skalkotos <skalkoto@grnet.gr>
Fri, 20 Jul 2012 12:30:23 +0000 (15:30 +0300)
committerNikos Skalkotos <skalkoto@grnet.gr>
Fri, 20 Jul 2012 12:30:23 +0000 (15:30 +0300)
Change msg field to messages in monitoring messages with type
image-helper and subtype error or warning. The new field is a list
of strings.

snf-image-host/helper-monitor.py

index 292bc5a..2d8575a 100755 (executable)
@@ -33,9 +33,9 @@ MSG_TYPE = 'image-helper'
 PROTOCOL = {
     'TASK_START': ('task-start', 'task'),
     'TASK_END': ('task-end', 'task'),
-    'WARNING': ('warning', 'msg'),
+    'WARNING': ('warning', 'messages'),
     'STDERR': ('error', 'stderr'),
-    'ERROR': ('error', 'msg')}
+    'ERROR': ('error', 'messages')}
 
 
 def error(msg):
@@ -139,6 +139,9 @@ if __name__ == "__main__":
                 or line.startswith("WARNING:") \
                 or line.startswith("ERROR:"):
                 (msg_type, _, value) = line.partition(':')
+
+                if line.startswith("WARNING:") or line.startswith("ERROR:"):
+                    value = [value]
                 send(fd, msg_type, value)
             else:
                 error("Unknown command!")