Skip to content

Commit 47c3b25

Browse files
authored
Add 'wire' as a valid value for cli_timestamp_format. (#9800)
1 parent 58d95ba commit 47c3b25

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "enhancement",
3+
"category": "timestamps",
4+
"description": "Add ``wire`` as a valid value for ``cli_timestamp_format``."
5+
}

awscli/customizations/scalarparse.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,19 @@ def add_timestamp_parser(session):
4949
try:
5050
timestamp_format = session.get_scoped_config().get(
5151
'cli_timestamp_format',
52-
'none')
52+
'wire')
5353
except ProfileNotFound:
5454
# If a --profile is provided that does not exist, loading
5555
# a value from get_scoped_config will crash the CLI.
5656
# This function can be called as the first handler for
5757
# the session-initialized event, which happens before a
5858
# profile can be created, even if the command would have
5959
# successfully created a profile. Instead of crashing here
60-
# on a ProfileNotFound the CLI should just use 'none'.
61-
timestamp_format = 'none'
62-
if timestamp_format == 'none':
60+
# on a ProfileNotFound the CLI should just use 'wire'.
61+
timestamp_format = 'wire'
62+
# We also support 'none' for backwards compatibility reasons, though we
63+
# document 'wire' instead.
64+
if timestamp_format == 'wire' or timestamp_format == 'none':
6365
# For backwards compatibility reasons, we replace botocore's timestamp
6466
# parser (which parses to a datetime.datetime object) with the
6567
# identity function which prints the date exactly the same as it comes
@@ -69,7 +71,7 @@ def add_timestamp_parser(session):
6971
timestamp_parser = iso_format
7072
else:
7173
raise ValueError('Unknown cli_timestamp_format value: %s, valid values'
72-
' are "none" or "iso8601"' % timestamp_format)
74+
' are "none", "wire" or "iso8601"' % timestamp_format)
7375
factory.set_parser_defaults(timestamp_parser=timestamp_parser)
7476

7577

awscli/topics/config-vars.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The valid values of the ``output`` configuration variable are:
9898
``cli_timestamp_format`` controls the format of timestamps displayed by the AWS CLI.
9999
The valid values of the ``cli_timestamp_format`` configuration variable are:
100100

101-
* none - Display the timestamp exactly as received from the HTTP response.
101+
* wire - Display the timestamp exactly as received from the HTTP response.
102102
* iso8601 - Reformat timestamp using iso8601 in the UTC timezone.
103103

104104
``cli_follow_urlparam`` controls whether or not the CLI will attempt to follow

tests/unit/customizations/test_scalarparse.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ def test_choose_none_timestamp_formatter(self):
4949
factory.set_parser_defaults.assert_called_with(
5050
timestamp_parser=scalarparse.identity)
5151

52+
def test_choose_wire_timestamp_formatter(self):
53+
session = mock.Mock(spec=Session)
54+
session.get_scoped_config.return_value = {'cli_timestamp_format':
55+
'wire'}
56+
factory = session.get_component.return_value
57+
scalarparse.add_scalar_parsers(session)
58+
factory.set_parser_defaults.assert_called_with(
59+
timestamp_parser=scalarparse.identity)
60+
5261
def test_choose_iso_timestamp_formatter(self):
5362
session = mock.Mock(spec=Session)
5463
session.get_scoped_config.return_value = {'cli_timestamp_format':

0 commit comments

Comments
 (0)