This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-2595
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit d1b8ccad5230a9f870d7c4640b3c2f77b0a06d3b
Author: leonidfrolov <[email protected]>
AuthorDate: Wed Nov 17 12:08:31 2021 +0200

    [DATALAB-2595]: aws instance status is checked only if instance id is 
present
---
 .../src/general/lib/aws/meta_lib.py                       | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/aws/meta_lib.py 
b/infrastructure-provisioning/src/general/lib/aws/meta_lib.py
index 858c58d..063b215 100644
--- a/infrastructure-provisioning/src/general/lib/aws/meta_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/meta_lib.py
@@ -738,13 +738,14 @@ def get_list_instance_statuses(instance_ids):
     for h in instance_ids:
         host = {}
         try:
-            response = 
client.describe_instances(InstanceIds=[h.get('id')]).get('Reservations')
-            for i in response:
-                inst = i.get('Instances')
-                for j in inst:
-                    host['id'] = j.get('InstanceId')
-                    host['status'] = j.get('State').get('Name')
-                    data.append(host)
+            if 'id' in h:
+                response = 
client.describe_instances(InstanceIds=[h.get('id')]).get('Reservations')
+                for i in response:
+                    inst = i.get('Instances')
+                    for j in inst:
+                        host['id'] = j.get('InstanceId')
+                        host['status'] = j.get('State').get('Name')
+                        data.append(host)
         except Exception as err:
             host['id'] = i.get('id')
             host['status'] = 'terminated'

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to