Skip to content

[LIBCLOUD-749] CloudStack: fixed method ex_authorize_security_group_ingress#580

Closed
schaubl wants to merge 3 commits into
apache:trunkfrom
schaubl:LIBCLOUD-749_cloudstack-fixed-ex_authorize_security_group_ingress
Closed

[LIBCLOUD-749] CloudStack: fixed method ex_authorize_security_group_ingress#580
schaubl wants to merge 3 commits into
apache:trunkfrom
schaubl:LIBCLOUD-749_cloudstack-fixed-ex_authorize_security_group_ingress

Conversation

@schaubl

@schaubl schaubl commented Sep 15, 2015

Copy link
Copy Markdown
Contributor

Corresponding ticket in the JIRA issue tracker: LIBCLOUD-749

This PR fixes the following bugs:

  • The docstring doesn't match parameters of the method.
  • Only ICMP and TCP is allowed even if the doc of the parameter protocol mention TCP and UDP.
  • Moreover ICMP cannot be used because there is no way to specify the two required parameters icmptype and icmpcode.
  • The parameter endport is not used if it's defined.
  • The return type is not a list but a dict.
  • The unit test doesn't use parameters in the correct order.

This PR also does the following changes:

  • Improve the docstring to be a bit more detailed (the previous one comes from the official Apache CloudStack documentation).
  • Add a kwargs to allow to provide extra parameters defined in the API and in the docstring.
  • Improve the unit test.
  • Add support for other protocols like AH, GRE and ESP which are available on some Cloud like Exoscale.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please explicitly declare all the supported arguments instead of using **kwargs?

@Kami

Kami commented Sep 20, 2015

Copy link
Copy Markdown
Member

Added one comment, besides that, LGTM. Thanks.

/cc @Runseb

@sebgoa

sebgoa commented Sep 21, 2015

Copy link
Copy Markdown
Member

LGTM, I will merge in the coming days

@schaubl

schaubl commented Sep 21, 2015

Copy link
Copy Markdown
Contributor Author

@Kami : Thanks for the comment which allowed me to discover a small issue in the docstring (securitygroupid and usersecuritygrouplist were noted as :param instead of :keyword).

Can you please explicitly declare all the supported arguments instead of using **kwargs?

Yes, of course. I used kwargs because it's the way some "unusual" parameters (like domainid and projectid) are passed with this driver. For example the method create_key_pair takes the name of the keypair and then parameters like domainid and projectid are passed via kwargs.

To be consistent I would suggest to keep it like this.
Please tell me if you still want than these parameters to be explicitly declared.

@Kami

Kami commented Oct 11, 2015

Copy link
Copy Markdown
Member

Sorry for the delay - I went ahead and merged the changes.

For now, lets keep kwargs, but in the future it would be great if we can get rid of it and explicitly declare all the supported arguments - (ab)using kwargs makes many things such as "static" analysis hard / impossible.

@asfgit asfgit closed this in 550dcf4 Oct 11, 2015
asfgit pushed a commit that referenced this pull request Oct 11, 2015
Closes #580

Signed-off-by: Tomaz Muraus <tomaz@apache.org>
asfgit pushed a commit that referenced this pull request Oct 11, 2015
…x_authorize_security_group_ingress

Closes #580

Signed-off-by: Tomaz Muraus <tomaz@apache.org>
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.

3 participants