2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-22 03:03:16 +00:00

Add ObjectGroup support to the server

This change ObjectGroup attribute support to the server, allowing
for the storage and retrieval of the new attribute in addition to
object filtering based on its value. New unit tests have been
added to cover the new changes.
This commit is contained in:
Peter Hamilton
2019-10-10 17:34:28 -04:00
committed by Peter Hamilton
parent 1b81fff431
commit 009e8cecc9
3 changed files with 133 additions and 8 deletions

View File

@@ -725,7 +725,7 @@ class KmipEngine(object):
elif attr_name == 'Archive Date':
return None
elif attr_name == 'Object Group':
return None
return [x.object_group for x in managed_object.object_groups]
elif attr_name == 'Fresh':
return None
elif attr_name == 'Link':
@@ -797,6 +797,11 @@ class KmipEngine(object):
application_data=value.application_data
)
)
elif attribute_name == "Object Group":
for value in attribute_value:
managed_object.object_groups.append(
objects.ObjectGroup(object_group=value.value)
)
else:
# TODO (peterhamilton) Remove when all attributes are supported
raise exceptions.InvalidField(
@@ -1698,6 +1703,16 @@ class KmipEngine(object):
)
add_object = False
break
elif name == "Object Group":
if value.value not in attribute:
self._logger.debug(
"Failed match: "
"the specified object group ('{}') does not "
"match any of the object's associated object "
"group attributes.".format(value.value)
)
add_object = False
break
elif name == "Name":
if value not in attribute:
self._logger.debug(