Skip to content

Commit 1165262

Browse files
DSpeichertDean Troyer
authored andcommitted
Send 'changes-since' instead of 'changes_since' query parameter
Per API reference, only 'changes-since' is accepted and the variant with underscore is ignored, making the CLI functionality broken. [dtroyer] added release note and fixed unit tests. Change-Id: I0c596531a8af03da17d5ce39d75b12e941403aa5 Closes-Bug: 1732216
1 parent 4742d4d commit 1165262

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,17 +1056,18 @@ def take_action(self, parsed_args):
10561056
'all_tenants': parsed_args.all_projects,
10571057
'user_id': user_id,
10581058
'deleted': parsed_args.deleted,
1059-
'changes_since': parsed_args.changes_since,
1059+
'changes-since': parsed_args.changes_since,
10601060
}
10611061
LOG.debug('search options: %s', search_opts)
10621062

1063-
if search_opts['changes_since']:
1063+
if search_opts['changes-since']:
10641064
try:
1065-
timeutils.parse_isotime(search_opts['changes_since'])
1065+
timeutils.parse_isotime(search_opts['changes-since'])
10661066
except ValueError:
1067-
raise exceptions.CommandError(_('Invalid changes-since value:'
1068-
' %s') % search_opts['changes'
1069-
'_since'])
1067+
raise exceptions.CommandError(
1068+
_('Invalid changes-since value: %s') %
1069+
search_opts['changes-since']
1070+
)
10701071

10711072
if parsed_args.long:
10721073
columns = (

openstackclient/tests/unit/compute/v2/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ def setUp(self):
15841584
'all_tenants': False,
15851585
'user_id': None,
15861586
'deleted': False,
1587-
'changes_since': None,
1587+
'changes-since': None,
15881588
}
15891589

15901590
# Default params of the core function of the command in the case of no
@@ -1791,7 +1791,7 @@ def test_server_list_with_changes_since(self):
17911791
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
17921792
columns, data = self.cmd.take_action(parsed_args)
17931793

1794-
self.search_opts['changes_since'] = '2016-03-04T06:27:59Z'
1794+
self.search_opts['changes-since'] = '2016-03-04T06:27:59Z'
17951795
self.search_opts['deleted'] = True
17961796
self.servers_mock.list.assert_called_with(**self.kwargs)
17971797

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fix the operation of the ``--changes-since`` option to the ``server list`` command.
5+
[Bug `1732216 <https://bugs.launchpad.net/python-openstackclient/+bug/1732216>`_]

0 commit comments

Comments
 (0)