-
Notifications
You must be signed in to change notification settings - Fork 922
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
Add policy management methods to the ELB driver #253
Conversation
added test suite for the ex_rename() extention method changed ex_rename() to ex_rename_node() extention method Added the MockHttptestcase from ex_rename_node() extension method changed ex_rename() to ex_rename_node() extention method corrected the MockHttptestcase for ex_rename_node() method Added a fixture for ex_rename_node() method
@@ -63,6 +63,42 @@ def list_balancers(self): | |||
data = self.connection.request(ROOT, params=params).object | |||
return self._to_balancers(data) | |||
|
|||
def ex_list_balancer_policy(self): |
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.
This method returns a list so it should have a plural name (policy -> policies).
Please also add a docstring which documents what the method does and what it returns.
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.
Yeah I was using doc string initially but found that no other methods have and so I removed them. Now I will add them.
@rahulrrixe I'm not sure exactly what you mean with "I am not able to debug the elb.py individually". You don't have an AWS account? Or is it something else? |
@@ -132,6 +168,16 @@ def balancer_detach_member(self, balancer, member): | |||
def balancer_list_members(self, balancer): | |||
return balancer._members | |||
|
|||
def _to_ex_policy(self, data): |
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.
Same here (plural name).
To make this useful, we also need to implement This method actually applies a policy to the load balancer. From the article:
|
@Kami Thanks I will make the required changes. regarding debugging I have fixed everything and its working fine and now working on writing test suits. |
@Kami I have checked all the methods with the aws instance and they all are working fine. |
@@ -17,7 +17,7 @@ | |||
'ElasticLBDriver' | |||
] | |||
|
|||
|
|||
from libcloud.utils.py3 import httplib |
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.
Deleting those empty lines breaks lint (pep8 step) - https://travis-ci.org/apache/libcloud/jobs/19573774
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.
@Kami I will take care of it in future.
There are still lint and test failures btw - https://travis-ci.org/apache/libcloud/builds/19573773 |
@@ -55,6 +54,15 @@ def __init__(self, access_id, secret, region): | |||
self.region = region | |||
self.connection.host = HOST % (region) | |||
|
|||
def create_list_params(self, params, items, label): |
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.
I would prefer this item to return a new params
list instead of mutate params
argument in place.
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.
Also, please make this a "private" method and move it to the end of the class.
@Kami I have made all the changes that you have suggested and also written test suits for the newly added extension methods. I am getting lint failure at some places, will fix them soon. Can you give me your feedback on these changes? |
response = self.connection.request(ROOT, params=params) | ||
return response.status == httplib.OK | ||
|
||
def ex_set_balancer_policies_listener(self, balancer, balancer_port, policies): |
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.
balancer_port
should probably be port
to be consistent with other methods.
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.
@Kami balancer_port
I have given specifically in the method to differentiate it from instance_port
It would also be good to add some documentation and examples of how to use that. Adding an example for common scenario like creating a listener and setting a policy for SSL would be good. |
@Kami I will add the documentation for the examples and also update different docstring's. |
Just want to make sure we are both on the same page. I meant adding documentation and examples to docs/loadbalancer/drivers/elb.rst :) |
@Kami I have also added the documentation for the elb driver. |
@rahulrrixe Awesome! I will review it and add some comments a bit later on. |
@@ -0,0 +1,109 @@ | |||
======================================== |
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.
Please use consistent heading styles - for example, see docs/compute/drivers/cloudsigma.rst
.
@rahulrrixe You can do: xpath = 'DescribeLoadBalancerPolicyTypesResult'
xpath += '/PolicyTypeDescriptions/member' |
@Kami I have updated the documentation but its facing some indentation error. Can you please suggest how can i debug it. |
@rahulrrixe It looks like you are using invalid syntax. You should remove pipes ( |
@Kami build successful 👍 |
@rahulrrixe Great. Can you please squash all the commits and all go ahead and merge the changes. |
@Kami sure |
…thod Added test suite for ex_create_balancer_policy() and ex_destroy_balancer_policy() method Added ex_set_balancer_policies_listener(self, balancer) method added all the methods required for adding & deleting policies corrected the docstring and positioning of methods added testsuits for extension methods fixture for ex_create_balancer_policy() method fixture for ex_list_balancer_policies() method fixture for ex_list_balancer_policy_types() method fixture for ex_set_balancer_policies_backend_server() method fixture for ex_set_balancer_policies_listener() method removed basestring for python 3 support PEP8 guidelines fixture added the documentation for the extension methods corrected various docstrings corrected various docstrings and lint correct the lint and added argument names pep8 fixtures pep8 fixtures made changes in the doc python code of creating connection for the doc made changes in the doc python code for creating policy for doc ref python code for creating load balancer for doc ref python code for creating balancer listeners for doc ref python code for deleting balancer policy for doc ref python code for listing balancer policies for doc ref python code for listing balancer policy types for doc ref python code for set balancer policy types for backend server python code for set balancer policy types for listeners list all the load balancers all method implemetation of ELB driver improved the documentation pep8 correction removed indendation error update the docstrings update the docstrings removed invalid syntax removed sphinx build errors
@Kami done 👍 |
I made some minor changes and fixed to the code examples and merged this patch into trunk. Thanks. |
@Kami I am not able to debug the elb.py individually. I have followed the testing guidlines from the official documentation.
P.S. From now onward i will create pull request after i have made few changes. I am not used to it, because in fedora community we used to discuss things on fpaste and then create pr.