Skip to content

Commit

Permalink
Add instance lifecycle info for GCE.
Browse files Browse the repository at this point in the history
TERMINATED state for a stopped instance can be confusing.
Fix malformed docstring in get_message_from_http_error method.
  • Loading branch information
smarlowucf committed Apr 21, 2020
1 parent 70fe483 commit 53eae6e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion img_proof/ipa_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def get_message_from_http_error(error, resource_name):
"""
Attempt to parse error message from json.
If there is an error get message use a default message string.
If there is an error getting the message content
use the default of `resource not found`.
"""
with suppress(AttributeError):
# In python 3.5 content is bytes
Expand Down Expand Up @@ -541,6 +542,8 @@ def _stop_instance(self):
instance=self.running_instance_id
).execute()

# In GCE an instance that is stopped has a state of TERMINATED:
# https://cloud.google.com/compute/docs/instances/instance-life-cycle
self._wait_on_instance(
'TERMINATED',
timeout=self.timeout
Expand Down

0 comments on commit 53eae6e

Please sign in to comment.