[PATCH] Fix indication_tester to send proper Content-Type

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1208836847 25200 # Node ID 00549613964a06a76d614151c3dfa86881169177 # Parent fdd1e960ba1d092dffe072d373824baca5276877 Fix indication_tester to send proper Content-Type. Changed the Content-Type from text/cimxml to application/xml. Also change the exception text to print the request return code and error message. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r fdd1e960ba1d -r 00549613964a tools/indication_tester.py --- a/tools/indication_tester.py Fri Apr 18 14:18:01 2008 -0700 +++ b/tools/indication_tester.py Mon Apr 21 21:00:47 2008 -0700 @@ -317,7 +317,7 @@ headers = {"CIMOperation" : "MethodCall", "CIMMethod" : method, "CIMObject" : "root/PG_Interop", - "Content-Type" : "text/cimxml"} + "Content-Type" : 'application/xml; charset="utf-8"'} if auth_hdr: headers["Authorization"] = "Basic %s" % auth_hdr @@ -325,7 +325,8 @@ conn.request("POST", "/cimom", body, headers) resp = conn.getresponse() if not resp.getheader("content-length"): - raise Exception("Authentication (or request) Failed!") + raise Exception("Request Failed: %d %s" % + (resp.status, resp.reason)) resp.read()

@@ -325,7 +325,8 @@ conn.request("POST", "/cimom", body, headers) resp = conn.getresponse() if not resp.getheader("content-length"): - raise Exception("Authentication (or request) Failed!") + raise Exception("Request Failed: %d %s" % + (resp.status, resp.reason))
resp.read()
I was able to track the issue down to a problem in the header. I found info on the content type here: http://www.dmtf.org/standards/documents/WBEM/DSP200.html (section 4.2.1) http://www.openpegasus.org/uploads/40/3452/WBEMIndications.pdf (page 56) Both of these documents are fairly old, but this change seems to work using Pegasus 2.7.0. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

KR> @@ -325,7 +325,8 @@ KR> conn.request("POST", "/cimom", body, headers) KR> resp = conn.getresponse() KR> if not resp.getheader("content-length"): KR> - raise Exception("Authentication (or request) Failed!") KR> + raise Exception("Request Failed: %d %s" % KR> + (resp.status, resp.reason)) This hunk fails for me. Good job hunting this one down :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> @@ -325,7 +325,8 @@ KR> conn.request("POST", "/cimom", body, headers) KR> resp = conn.getresponse() KR> if not resp.getheader("content-length"): KR> - raise Exception("Authentication (or request) Failed!") KR> + raise Exception("Request Failed: %d %s" % KR> + (resp.status, resp.reason))
This hunk fails for me.
Weird, I cloned a new tree and didn't have any problems applying.
Good job hunting this one down :)
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert