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

Add policy management methods to the ELB driver #253

Closed
wants to merge 3 commits into from
Closed

Add policy management methods to the ELB driver #253

wants to merge 3 commits into from

Conversation

rakontuh
Copy link

@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.

Rahul Ranjan added 2 commits February 19, 2014 17:21
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):
Copy link
Member

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.

Copy link
Author

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.

@Kami
Copy link
Member

Kami commented Feb 23, 2014

@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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here (plural name).

@Kami
Copy link
Member

Kami commented Feb 23, 2014

To make this useful, we also need to implement SetLoadBalancerPoliciesOfListener method (http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/API_SetLoadBalancerPoliciesOfListener.html).

This method actually applies a policy to the load balancer.

From the article:

elb-create-lb-policy  myELBName        \
  --policy-type SSLNegotiationPolicyType \
  --policy-name=mySSLPolicyName        \
  --attribute "name=Reference-Security-Policy, value=ELBSecurityPolicy-2014-01"

$ elb-set-lb-policies-of-listener  myELBName \
  --lb-port 443 \
  --policy-names mySSLPolicyName,[PolicyName2,...]

@rakontuh
Copy link
Author

@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.

@rakontuh
Copy link
Author

@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
Copy link
Member

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

Copy link
Author

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.

@Kami
Copy link
Member

Kami commented Feb 25, 2014

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):
Copy link
Member

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.

Copy link
Member

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.

@rakontuh
Copy link
Author

@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):
Copy link
Member

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.

Copy link
Author

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

@Kami
Copy link
Member

Kami commented Feb 26, 2014

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.

@rakontuh
Copy link
Author

@Kami I will add the documentation for the examples and also update different docstring's.

@Kami
Copy link
Member

Kami commented Feb 26, 2014

Just want to make sure we are both on the same page.

I meant adding documentation and examples to docs/loadbalancer/drivers/elb.rst :)

@rakontuh
Copy link
Author

@Kami I have also added the documentation for the elb driver.

@Kami
Copy link
Member

Kami commented Feb 28, 2014

@rahulrrixe Awesome!

I will review it and add some comments a bit later on.

@@ -0,0 +1,109 @@
========================================
Copy link
Member

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.

@Kami
Copy link
Member

Kami commented Feb 28, 2014

@rahulrrixe You can do:

xpath = 'DescribeLoadBalancerPolicyTypesResult'
xpath += '/PolicyTypeDescriptions/member' 

@rakontuh
Copy link
Author

rakontuh commented Mar 2, 2014

@Kami I have updated the documentation but its facing some indentation error. Can you please suggest how can i debug it.

@Kami
Copy link
Member

Kami commented Mar 2, 2014

@rahulrrixe It looks like you are using invalid syntax. You should remove pipes (|) before the code snippets.

@rakontuh
Copy link
Author

rakontuh commented Mar 2, 2014

@Kami build successful 👍
Checked all the methods and test suits again on local system, everything is working fine. Also I tried to improve the documentation and will do more in future.

@Kami
Copy link
Member

Kami commented Mar 2, 2014

@rahulrrixe Great.

Can you please squash all the commits and all go ahead and merge the changes.

@rakontuh
Copy link
Author

rakontuh commented Mar 2, 2014

@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
@rakontuh
Copy link
Author

rakontuh commented Mar 2, 2014

@Kami done 👍

@Kami
Copy link
Member

Kami commented Mar 3, 2014

I made some minor changes and fixed to the code examples and merged this patch into trunk.

Thanks.

@asfgit asfgit closed this in 68f8d22 Mar 3, 2014
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

Successfully merging this pull request may close these issues.

None yet

2 participants