Can't create a metadata named key, clear, delete

We now pass metadata as a dictionnary and not as keyword arguments since
_metadata method already have 3 keywords arguments (key, clear and delete)
which couldn't be used as metadata keys.

Change-Id: Iee3773e4e9a4187bd1557f400aa966f80e3acb3c
Story: 2005085
Task: 35787
This commit is contained in:
Grégoire Unbekandt 2019-07-11 14:20:08 +02:00
parent bf6651f149
commit 2081befb92
2 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,8 @@ from openstack import utils
class MetadataMixin(object):
def _metadata(self, method, key=None, clear=False, delete=False,
**metadata):
metadata=None):
metadata = metadata or {}
for k, v in metadata.items():
if not isinstance(v, six.string_types):
raise ValueError("The value for %s (%s) must be "
@ -84,7 +85,7 @@ class MetadataMixin(object):
if not metadata:
return dict()
result = self._metadata(session.post, **metadata)
result = self._metadata(session.post, metadata=metadata)
return result["metadata"]
def delete_metadata(self, session, keys):

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixed a bug related to metadata's key name. An exception was
raised when setting it to "delete"," clear" or "key"