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