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
This commit is contained in:
Daniel Speichert 2017-11-14 11:14:11 -05:00 committed by Dean Troyer
parent 4742d4df70
commit 116526275d
3 changed files with 14 additions and 8 deletions

View File

@ -1056,17 +1056,18 @@ class ListServer(command.Lister):
'all_tenants': parsed_args.all_projects,
'user_id': user_id,
'deleted': parsed_args.deleted,
'changes_since': parsed_args.changes_since,
'changes-since': parsed_args.changes_since,
}
LOG.debug('search options: %s', search_opts)
if search_opts['changes_since']:
if search_opts['changes-since']:
try:
timeutils.parse_isotime(search_opts['changes_since'])
timeutils.parse_isotime(search_opts['changes-since'])
except ValueError:
raise exceptions.CommandError(_('Invalid changes-since value:'
' %s') % search_opts['changes'
'_since'])
raise exceptions.CommandError(
_('Invalid changes-since value: %s') %
search_opts['changes-since']
)
if parsed_args.long:
columns = (

View File

@ -1584,7 +1584,7 @@ class TestServerList(TestServer):
'all_tenants': False,
'user_id': None,
'deleted': False,
'changes_since': None,
'changes-since': None,
}
# Default params of the core function of the command in the case of no
@ -1791,7 +1791,7 @@ class TestServerList(TestServer):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
self.search_opts['changes_since'] = '2016-03-04T06:27:59Z'
self.search_opts['changes-since'] = '2016-03-04T06:27:59Z'
self.search_opts['deleted'] = True
self.servers_mock.list.assert_called_with(**self.kwargs)

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fix the operation of the ``--changes-since`` option to the ``server list`` command.
[Bug `1732216 <https://bugs.launchpad.net/python-openstackclient/+bug/1732216>`_]