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

how filter works? #40

Open
ghost opened this issue Mar 22, 2016 · 10 comments
Open

how filter works? #40

ghost opened this issue Mar 22, 2016 · 10 comments

Comments

@ghost
Copy link

ghost commented Mar 22, 2016

Could you please provide example of how plumbum filter works? I wasn't able to figure out how it work and receiving errors all the time.

Traceback (most recent call last):
  File "/home/vagrant/.pyenv/versions/2.7.6/bin/plumbum", line 11, in <module>
    sys.exit(main())
  File "/home/vagrant/.pyenv/versions/2.7.6/lib/python2.7/site-packages/plumbum.py", line 222, in main
    resources = list_resources[namespace](region, filters)
  File "/home/vagrant/.pyenv/versions/2.7.6/lib/python2.7/site-packages/plumbum.py", line 136, in list_elb
    return lookup(instances, filter_by=filter_by_kwargs)
  File "/home/vagrant/.pyenv/versions/2.7.6/lib/python2.7/site-packages/plumbum.py", line 82, in lookup
    return list(filter(filter_key(filter_by), instances))
  File "/home/vagrant/.pyenv/versions/2.7.6/lib/python2.7/site-packages/plumbum.py", line 76, in filter_instance
    for key, value in filter_args.items()])
AttributeError: 'str' object has no attribute 'items'
@paul-krohn
Copy link
Collaborator

Can you provide the command/usage you employed that generated this output?

@ghost
Copy link
Author

ghost commented Mar 22, 2016

@paul-krohn Hi, this is the command that I executed. :) Thank you for the quick response.

vagrant@vagrant:~$ plumbum -r us-west-1 -f internal --toke elb.name='internal.us-west-1.elb.amazonaws.com' cloudwatch-to-graphite/sample_templates/elb.yml.j2 AWS/ELB

@paul-krohn
Copy link
Collaborator

There are a few problems here.

  • your filter has to take the form of key=value; this is not clear in the docs
  • filtering on objects that have a name (ie ELBs), as opposed to an ID (ie EC2 instances), is limited to the attributes in the AWS API; tags are not supported and this is not clear in the docs.
  • filtering is broken! This happened because there are no tests for it.

Can I interest you in perhaps fixing any of these things? It would be great to have another maintainer on board.

@tmclaugh
Copy link
Collaborator

There were a number of changes recently. Any idea where / when the filtering broke?

@paul-krohn
Copy link
Collaborator

I've never used the filtering, so I've no idea when it worked. :(

@tmclaugh
Copy link
Collaborator

@jasonatfleepio what version of the package? See #37 which is in release 0.9.2.

The template and namespace argument were swapped in a recent PR. I reverted it back.

@ghost
Copy link
Author

ghost commented Mar 22, 2016

uh, I'm in 0.9.0.

vagrant@vagrant:~$ plumbum --version
0.9.0

@tmclaugh
Copy link
Collaborator

Try 0.9.2 and your issue should go away.

@ghost
Copy link
Author

ghost commented Mar 24, 2016

@tmclaugh How can I install 0.9.2 with pip? I was installed with pip upgrading to 0.9.2, but still showing me 0.9.0

 $ pip install cloudwatch-to-graphite==0.9.2 --upgrade
Requirement already up-to-date: cloudwatch-to-graphite==0.9.2 in ./.pyenv/versions/2.7.6/lib/python2.7/site-packages
Requirement already up-to-date: boto in ./.pyenv/versions/2.7.6/lib/python2.7/site-packages (from cloudwatch-to-graphite==0.9.2)
Requirement already up-to-date: docopt in ./.pyenv/versions/2.7.6/lib/python2.7/site-packages (from cloudwatch-to-graphite==0.9.2)
Requirement already up-to-date: PyYAML in ./.pyenv/versions/2.7.6/lib/python2.7/site-packages (from cloudwatch-to-graphite==0.9.2)
Requirement already up-to-date: Jinja2 in ./.pyenv/versions/2.7.6/lib/python2.7/site-packages (from cloudwatch-to-graphite==0.9.2)
Requirement already up-to-date: MarkupSafe in ./.pyenv/versions/2.7.6/lib/python2.7/site-packages (from Jinja2->cloudwatch-to-graphite==0.9.2)
$ plumbum --version
0.9.0

@paul-krohn
Copy link
Collaborator

We'll need a push of tags 0.9.4 and 0.9.5 to PyPi before @jasonatfleepio can validate recent changes address his issue.

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