2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-14 23:33:19 +00:00

Updating the server to handle errors during attribute lookup

This change updates the server to better handle exceptions thrown
while looking up the value of different attributes on managed
objects. Some managed objects in PyKMIP don't currently support
attributes they are supposed to. This can cause lookup errors
when using GetAttributes. This change suppresses any exceptions
and simply returns None for the missing attribute value. The
server unit tests have been updated to account for this change.
This commit is contained in:
Peter Hamilton
2016-12-07 09:13:38 -05:00
parent bd76dc280b
commit e2841f1ee5
2 changed files with 46 additions and 4 deletions

View File

@@ -649,10 +649,13 @@ class KmipEngine(object):
attribute_name,
object_type
):
attribute_value = self._get_attribute_from_managed_object(
managed_object,
attribute_name
)
try:
attribute_value = self._get_attribute_from_managed_object(
managed_object,
attribute_name
)
except Exception:
attribute_value = None
if attribute_value is not None:
if self._attribute_policy.is_attribute_multivalued(