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

EC2 instance lookup "State:running" filter isn't working #11

Open
cybrosis opened this issue Dec 11, 2017 · 2 comments
Open

EC2 instance lookup "State:running" filter isn't working #11

cybrosis opened this issue Dec 11, 2017 · 2 comments

Comments

@cybrosis
Copy link

When I do a lookup on my existing ec2 instances by name after a re-deployment, the results list includes the terminated instances and the new running instances. As a result I have to quick look into each one to determine which one is running and which one is not.

As a quick fix I edited find_ec2() in aws.py to include the instance state in the results returned to alfred:

title = '%s (%s) (%s)' % (instance['Tag:Name'], instance['InstanceId'], instance['State']['Name'])

however, I would like to see terminated instances filtered out, or only running instances returned.

What do you think?

@twang-rs
Copy link
Collaborator

That probably makes a whole lot of sense.

You should be able to change line 17 from:

response = client.describe_instances(MaxResults=1000, **next_token)

to:

response = client.describe_instances(MaxResults=1000, Filters=[{
    'Name': 'instance-state-name',
    'Values': ['running'],
}], **next_token)

@cybrosis
Copy link
Author

cybrosis commented Dec 11, 2017

Fix implemented in pull request: #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants