Explorar o código

boto3 has the key_material field only if data exists

Enis Afgan %!s(int64=8) %!d(string=hai) anos
pai
achega
8a66c5a7b5
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      cloudbridge/cloud/providers/aws/resources.py

+ 5 - 1
cloudbridge/cloud/providers/aws/resources.py

@@ -537,7 +537,11 @@ class AWSKeyPair(BaseKeyPair):
 
     @property
     def material(self):
-        return self._key_pair.key_material
+        # boto3 object will only have this field if the value is not empty
+        if hasattr(self._key_pair, 'key_material'):
+            return self._key_pair.key_material
+        else:
+            return None
 
 
 class AWSSecurityGroup(BaseSecurityGroup):