Merge "Use ISO8601 format for timestamp fields"
This commit is contained in:
commit
55067a04ed
@ -3,9 +3,9 @@
|
||||
"events": [
|
||||
{
|
||||
"event": "container__do_container_start",
|
||||
"finish_time": "2018-03-04 17:03:07+00:00",
|
||||
"finish_time": "2018-03-04T17:03:07.000000",
|
||||
"result": "Success",
|
||||
"start_time": "2018-03-04 17:02:57+00:00",
|
||||
"start_time": "2018-03-04T17:02:57.000000",
|
||||
"traceback": null
|
||||
}
|
||||
],
|
||||
@ -13,6 +13,6 @@
|
||||
"message": null,
|
||||
"project_id": "853719b303ef4858a195535eb520e58d",
|
||||
"request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
|
||||
"start_time": "2018-03-04 17:02:54+00:00",
|
||||
"start_time": "2018-03-04T17:02:54.000000",
|
||||
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"message": null,
|
||||
"project_id": "853719b303ef4858a195535eb520e58d",
|
||||
"request_id": "req-25517360-b757-47d3-be45-0e8d2a01b36a",
|
||||
"start_time": "2018-03-04 19:48:49+00:00",
|
||||
"start_time": "2018-03-04T19:48:49.000000",
|
||||
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
||||
},
|
||||
{
|
||||
@ -15,7 +15,7 @@
|
||||
"message": null,
|
||||
"project_id": "853719b303ef4858a195535eb520e58d",
|
||||
"request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
|
||||
"start_time": "2018-03-04 17:02:54+00:00",
|
||||
"start_time": "2018-03-04T17:02:54.000000",
|
||||
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
||||
}
|
||||
]
|
||||
|
@ -4,13 +4,13 @@
|
||||
"binary": "zun-compute",
|
||||
"availability_zone": "nova",
|
||||
"state": "up",
|
||||
"created_at": "2017-02-01 03:25:07+00:00",
|
||||
"updated_at": "2017-02-01 06:13:07+00:00",
|
||||
"created_at": "2017-02-01T03:25:07.000000",
|
||||
"updated_at": "2017-02-01T06:13:07.000000",
|
||||
"report_count": 166,
|
||||
"disabled": false,
|
||||
"host": "instance-1",
|
||||
"forced_down": false,
|
||||
"last_seen_up": "2017-02-01 06:13:07+00:00",
|
||||
"last_seen_up": "2017-02-01T06:13:07.000000",
|
||||
"disabled_reason": null,
|
||||
"id": 1
|
||||
}
|
||||
|
@ -11,8 +11,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
import itertools
|
||||
|
||||
from zun.common import utils
|
||||
|
||||
|
||||
_action_keys = (
|
||||
'action',
|
||||
@ -39,6 +42,9 @@ def format_action(action):
|
||||
if key not in _action_keys:
|
||||
return
|
||||
|
||||
if isinstance(value, datetime.datetime):
|
||||
yield (key, utils.strtime(value))
|
||||
else:
|
||||
yield (key, value)
|
||||
|
||||
return dict(itertools.chain.from_iterable(
|
||||
@ -50,8 +56,12 @@ def format_event(event, show_traceback=False):
|
||||
if key not in _action_event_keys:
|
||||
return
|
||||
|
||||
if isinstance(value, datetime.datetime):
|
||||
yield (key, utils.strtime(value))
|
||||
else:
|
||||
if key == 'traceback' and not show_traceback:
|
||||
# By default, non-admins are not allowed to see traceback details.
|
||||
# By default, non-admins are not allowed to see traceback
|
||||
# details.
|
||||
yield (key, None)
|
||||
else:
|
||||
yield (key, value)
|
||||
|
@ -11,8 +11,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
import itertools
|
||||
|
||||
from zun.common import utils
|
||||
|
||||
|
||||
_basic_keys = (
|
||||
'availability_zone',
|
||||
@ -34,6 +37,9 @@ def format_service(service):
|
||||
def transform(key, value):
|
||||
if key not in _basic_keys:
|
||||
return
|
||||
if isinstance(value, datetime.datetime):
|
||||
yield (key, utils.strtime(value))
|
||||
else:
|
||||
yield (key, value)
|
||||
|
||||
return dict(
|
||||
|
@ -685,3 +685,7 @@ def decode_file_data(data):
|
||||
return base64.b64decode(data)
|
||||
except (TypeError, binascii.Error):
|
||||
raise exception.Base64Exception()
|
||||
|
||||
|
||||
def strtime(at):
|
||||
return at.strftime("%Y-%m-%dT%H:%M:%S.%f")
|
||||
|
Loading…
Reference in New Issue
Block a user