Update queue metadata failed when the original value is zero.

Such as the problem, the current set or update the queue of metadata, it
may fail.

The reproduction steps are as follows:

- Set or update the metadata to 0 (some metadata can be zero).
- And then update it again will fail (always 0), because 0 was filter by
  client.

Closes-Bug: #1729193
Change-Id: I4e3c4aa3634ba33e4e9501c6c27bac77c0e43ea8
This commit is contained in:
yangzhenyu 2017-10-31 19:08:58 +08:00
parent 05dd0f65cc
commit cbfc28fa48
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class Queue(queues.Queue):
changes = []
for key, value in new_meta.items():
# If key exists, replace it's value.
if self._metadata.get(key, None):
if self._metadata.get(key, None) is not None:
changes.append({'op': 'replace',
'path': '/metadata/%s' % key,
'value': value})