diff options
| author | Steve Martinelli <s.martinelli@gmail.com> | 2016-09-05 10:15:57 -0700 |
|---|---|---|
| committer | Steve Martinelli <s.martinelli@gmail.com> | 2016-09-05 17:23:42 +0000 |
| commit | 24c8b94baf4c95cd3a76159009badbc53573be09 (patch) | |
| tree | 48624db47624ab993b7cd7a270d8f39b2ef43640 /openstackclient/identity | |
| parent | 3b75c9aae55356e8f7b2c04e0101ede99d860c1a (diff) | |
| download | python-openstackclient-24c8b94baf4c95cd3a76159009badbc53573be09.tar.gz | |
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
Diffstat (limited to 'openstackclient/identity')
| -rw-r--r-- | openstackclient/identity/v2_0/token.py | 4 | ||||
| -rw-r--r-- | openstackclient/identity/v3/token.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py index 56f920f3..4b7e988b 100644 --- a/openstackclient/identity/v2_0/token.py +++ b/openstackclient/identity/v2_0/token.py @@ -42,7 +42,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: 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: |
