Skip to content

Commit 54de413

Browse files
Fixed issue with ignore group
1 parent d41d1ad commit 54de413

File tree

1 file changed

+13
-13
lines changed
  • jobs/vpc-auto-stop-start

1 file changed

+13
-13
lines changed

jobs/vpc-auto-stop-start/app.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def stop_vpc_instances():
6969
instance_id = instance['id']
7070
instance_name = instance['name']
7171
if instance_name not in ignore_group:
72-
print(f"Stopping instance {instance_id}")
72+
print(f"Stopping instance {instance_name}")
7373
response = client.create_instance_action(instance_id=instance_id, type='stop').get_result()
7474
logging.info(response)
7575
except ApiException as e:
@@ -88,19 +88,19 @@ def start_vpc_instances():
8888
for instance in list_instances:
8989
instance_id = instance['id']
9090
instance_name = instance['name']
91-
if instance_name not in ignore_group:
92-
print(f"Starting instance {instance_id}")
93-
response = client.create_instance_action(instance_id=instance_id, type='start').get_result()
94-
logging.info(response)
91+
92+
print(f"Starting instance {instance_name}")
93+
response = client.create_instance_action(instance_id=instance_id, type='start').get_result()
94+
logging.info(response)
9595

96-
while True:
97-
instance_status = client.get_instance(id=instance_id).get_result()['status']
98-
if instance_status == 'running':
99-
logging.info(f"Instance {instance_id} is now running")
100-
break
101-
else:
102-
logging.info(f"Instance {instance_id} status: {instance_status}. Waiting...")
103-
time.sleep(5)
96+
while True:
97+
instance_status = client.get_instance(id=instance_id).get_result()['status']
98+
if instance_status == 'running':
99+
logging.info(f"Instance {instance_id} is now running")
100+
break
101+
else:
102+
logging.info(f"Instance {instance_id} status: {instance_status}. Waiting...")
103+
time.sleep(5)
104104
except ApiException as e:
105105
print("Failed to start instances: %s\n" % e)
106106

0 commit comments

Comments
 (0)