-
Notifications
You must be signed in to change notification settings - Fork 930
loadbalancer/rackspace/list_balancers: add params #803
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
Conversation
85608cb
to
f41c725
Compare
thanks for the contribution @raittes - libcloud convention is that any arguments which are not present in the base class methods are prepending with Ideally, there would be named keyword arguments for typical arguments, according to the docs https://developer.rackspace.com/docs/cloud-load-balancers/v1/developer-guide/#list-load-balancers they would include status, nodeaddress and changes-since. |
f41c725
to
17cb8bf
Compare
Hi @tonybaloney, I've updated the PR, please check it out! |
@tonybaloney, something is missing? |
if ex_changes_since: | ||
params['changes-since'] = ex_changes_since | ||
|
||
for key, value in ex_params.iteritems(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dict.iteritems()
is not valid in Python 3, you must use items().
Which probably highlights that this code doesn't have a supporting unit test as TravisCI should have picked that up. please can you add a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Tests are ok, I forced push and TravisCI may have missed something.
Here another build: https://travis-ci.org/raittes/libcloud/jobs/140894397
======================================================================
ERROR: test_destroy_balancer (libcloud.test.loadbalancer.test_rackspace.RackspaceLBTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/raittes/projects/raittes/libcloud/libcloud/test/loadbalancer/test_rackspace.py", line 187, in test_destroy_balancer
balancer = self.driver.list_balancers()[0]
File "/home/raittes/projects/raittes/libcloud/libcloud/loadbalancer/drivers/rackspace.py", line 385, in list_balancers
for key, value in ex_params.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
17cb8bf
to
5edf7be
Compare
the commit came in after your comment, but the build passed now that the py3 compatibility issue was fixed up |
Load Balancer / Rackspace: allow params on listing load balancers
Description
Allow to set params to be submitted in the query string to API request.
By default, Rackspace API return a maximum of 100 items at a time.
This change allow to set "offset" in the params, to paginate requests.
Ex.
list_balancers(ex_params={'offset': 100})
Status
Checklist