Comment 1 for bug 721297

Revision history for this message
Ken Pepple (ken-pepple) wrote :

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):
            for item in data:
                data_el.appendChild(self._render_data(xml, 'item', item))
        elif isinstance(data, dict):
            self._render_dict(xml, data_el, data)
        elif hasattr(data, '__dict__'):
            self._render_dict(xml, data_el, data.__dict__)
        elif isinstance(data, bool):
            data_el.appendChild(xml.createTextNode(str(data).lower()))
        elif data != None:
            data_el.appendChild(xml.createTextNode(str(data)))

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.createTextNode(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.