ocaml/xapi/xapi_vmpp.ml | 8 ++++----
scripts/mail-alarm | 6 +++++-
2 files changed, 9 insertions(+), 5 deletions(-)
# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1285341480 -3600
# Node ID 377a8710491fa9b66f159fc6a6faf527cd272d5e
# Parent 1e76d839159a258dec264d0469963df0036a9715
CA-46108: vmpp message must contain body and data
Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>
diff -r 1e76d839159a -r 377a8710491f ocaml/xapi/xapi_vmpp.ml
--- a/ocaml/xapi/xapi_vmpp.ml
+++ b/ocaml/xapi/xapi_vmpp.ml
@@ -59,9 +59,9 @@
let create_alert ~__context ~vmpp ~name ~priority ~body ~data =
assert_licensed ~__context;
- let value =
- (*"<message><email>"^body^"</email><data>"^data^"</data></message>"*)
- data
+ let value = data in
+ let msg =
+ "<message><email>"^body^"</email><data>"^value^"</data></message>"
in
let successful = priority < 5L in
if successful
@@ -72,7 +72,7 @@
add_to_recent_alerts ~__context ~vmpp ~value;
let cls = `VMPP in
let obj_uuid = Db.VMPP.get_uuid ~__context ~self:vmpp in
- Xapi_message.create ~__context ~name ~priority ~cls ~obj_uuid ~body;
+ Xapi_message.create ~__context ~name ~priority ~cls ~obj_uuid ~body:msg;
()
)
diff -r 1e76d839159a -r 377a8710491f scripts/mail-alarm
--- a/scripts/mail-alarm
+++ b/scripts/mail-alarm
@@ -297,11 +297,15 @@
def generate_body(self):
msg = self.msg
+ msg_body = unescape(msg.body)
try:
+ xmldoc = minidom.parseString(msg_body)
+ body_message = xmldoc.getElementsByTagName('message')[0]
+ email_message =
body_message.getElementsByTagName('email')[0].firstChild.data
return \
"Field\t\tValue\n-----\t\t-----\nName:\t\t%s\nPriority:\t%s\nClass:\t\t%s\n" \
"Object UUID:\t%s\nTimestamp:\t%s\nMessage UUID:\t%s\nPool
name:\t%s\nBody:\t\t%s\n" % \
-
(msg.name,msg.priority,msg.cls,msg.obj_uuid,msg.timestamp,msg.uuid,msg.pool_name,msg.body)
+
(msg.name,msg.priority,msg.cls,msg.obj_uuid,msg.timestamp,msg.uuid,msg.pool_name,email_message)
except:
log_err("Badly formatted XML, or missing field")
sys.exit(1)
xen-api.hg.patch
Description: Text Data
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|