Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid exception if instance has no tags #184

Merged
merged 3 commits into from
Jan 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions flintrock/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,9 @@ def launch(
if isinstance(e, InterruptedEC2Operation):
cleanup_instances = e.instances
else:
# TODO: There is no guarantee that cluster_instances is
# defined.
# See: https://github.com/nchammas/flintrock/issues/183
cleanup_instances = cluster_instances
_cleanup_instances(
instances=cleanup_instances,
Expand Down Expand Up @@ -1024,6 +1027,10 @@ def _get_cluster_master_slaves(
slave_instances = []

for instance in instances:
if not instance.tags:
# TODO: Better handle malformed clusters with missing tags.
# See: https://github.com/nchammas/flintrock/issues/183
continue
for tag in instance.tags:
if tag['Key'] == 'flintrock-role':
if tag['Value'] == 'master':
Expand Down