From 24c8b94baf4c95cd3a76159009badbc53573be09 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Mon, 5 Sep 2016 10:15:57 -0700 Subject: format token expires time to prevent json loading datetime data When output to shell, the token issue time is fine; however when selecting the json formatter (via the --format json) option, an exception is raised when formatting the dataetime data. Rather than pass in the datetime data, we should format the data with the ISO 8601 formatting. Closes-Bug: 1619937 Change-Id: Iffebb2d5413fabfd283dfa94fc560fc37270f9dd --- openstackclient/identity/v3/token.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openstackclient/identity/v3') diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py index ecf09693..2cd304e6 100644 --- a/openstackclient/identity/v3/token.py +++ b/openstackclient/identity/v3/token.py @@ -183,7 +183,9 @@ class IssueToken(command.ShowOne): if auth_ref.auth_token: data['id'] = auth_ref.auth_token if auth_ref.expires: - data['expires'] = auth_ref.expires + datetime_obj = auth_ref.expires + expires_str = datetime_obj.strftime('%Y-%m-%dT%H:%M:%S%z') + data['expires'] = expires_str if auth_ref.project_id: data['project_id'] = auth_ref.project_id if auth_ref.user_id: -- cgit v1.2.1