nova returns wrong date format in AWS API Calls
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Ken Pepple |
Bug Description
Hi, when we use the AWS API and call the describe instances method of the API it returns all the information for the instance but an error regarding the date format is also returned:
Parser exception:
734 [main] DEBUG httpclient.
766 [main] ERROR com.amazonaws.
java.text.
at java.text.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.amazonaws.
at com.sap.
at com.sap.
AWS Java SDK client uses the following Data formats:
/** ISO 8601 parser */
protected final SimpleDateFormat iso8601DateParser =
new SimpleDateForma
/** Alternate ISO 8601 parser without fractional seconds */
protected final SimpleDateFormat alternateIo8601
new SimpleDateForma
/** RFC 822 parser */
protected final SimpleDateFormat rfc822DateParser =
new SimpleDateForma
At least one of the two date formats should be kept for the “launchTime” in the sent response:
yyyy-MM-
or
yyyy-MM-
Example:
In Amazon, the correct parsable format is:
<launchTime>
In OpenStack – not parsable:
<launchTime>
<launchTime>
Is this some configuration option that can be configured somewhere, or it is a matter of implementation?
Thanks
Related branches
- Josh Kearney (community): Approve
- Jay Pipes (community): Approve
- bobya (community): Approve
-
Diff: 66 lines (+30/-1)2 files modifiednova/api/ec2/apirequest.py (+7/-1)
nova/tests/test_api.py (+23/-0)
Changed in nova: | |
status: | In Progress → Fix Committed |
Changed in nova: | |
status: | Fix Committed → In Progress |
Changed in nova: | |
status: | In Progress → Fix Committed |
Changed in nova: | |
importance: | Undecided → Medium |
Changed in nova: | |
milestone: | none → 2011.2 |
status: | Fix Committed → Fix Released |
I believe this is a matter of implementation. In nova/api/ ec2/apirequest. py:166, we _render_data according to the data class:
if isinstance(data, list):
data_ el.appendChild( self._render_ data(xml, 'item', item))
self. _render_ dict(xml, data_el, data)
self. _render_ dict(xml, data_el, data.__dict__)
data_ el.appendChild( xml.createTextN ode(str( data).lower( )))
data_ el.appendChild( xml.createTextN ode(str( data)))
for item in data:
elif isinstance(data, dict):
elif hasattr(data, '__dict__'):
elif isinstance(data, bool):
elif data != None:
However, we never actually check to see if the data is a datetime instance (which is what comes out of our database). By adding these two lines (before the final elif date != None):
elif isinstance(data, datetime.datetime):
data_ el.appendChild( xml.createTextN ode(data. isoformat( )))
I believe we will catch _all_ the dates (not sure if there are any others in the responses) and convert them to ISO format.
We need to add this type of parsing to our integration tests.