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

Fix openstack v3 authentication #744

Closed
wants to merge 2 commits into from

Conversation

schaubl
Copy link
Contributor

@schaubl schaubl commented Apr 12, 2016

Fix openstack v3 authentication

Description

This PR allows to define the OpenStack domain to another value that the default Default.
It also adds the ability to define the scope of the token.

With the code for the OpenStack Identity API v3, two new parameters were added: domain_name and token_scope but it was impossible to define them to a value other than their respective default.

Status

  • done, ready for review

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks)
  • Documentation
  • Tests
  • ICLA (required for bigger changes)

@Kami
Copy link
Member

Kami commented Apr 12, 2016

Great, thanks!

I will do a proper review later, but from a quick glance, it looks like it would be great to add some more tests to cover all the (edge) cases.

@schaubl
Copy link
Contributor Author

schaubl commented Apr 13, 2016

@Kami I don't know how to add tests for this fix because I need to check the body of the request but all tests seems to test the reply.

To test the body of the request I have to do it in OpenStackIdentity_3_0_MockHttp which is not a subclass of unittest.TestCase and doesn't have the assert... methods.

timeout=None, parent_conn=None):
super(OpenStackIdentityConnection, self).__init__(user_id=user_id,
key=key,
url=auth_url,
timeout=timeout)

self.auth_url = auth_url
Copy link
Member

Choose a reason for hiding this comment

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

(just thinking out loud)

I assume you removed those attributes since they are duplicated aka are declared again a couple of lines below, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right

@schaubl
Copy link
Contributor Author

schaubl commented Apr 15, 2016

@Kami: Now default values are specified in the method signature.
I also added back a test case and the condition which check if domain_name is defined.

:type token_scope: ``str``
"""
super(OpenStackIdentity_3_0_Connection,
self).__init__(auth_url=auth_url,
user_id=user_id,
key=key,
tenant_name=tenant_name,
domain_name=domain_name,
token_scope=token_scope,
timeout=timeout,
parent_conn=parent_conn)
Copy link
Contributor Author

@schaubl schaubl Apr 15, 2016

Choose a reason for hiding this comment

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

I would suggest to change that code to:

def __init__(self, *args, **kwargs):
    # Docstring
    super(OpenStackIdentity_3_0_Connection, self).__init__(*args, **kwargs)

So the signature doesn't have to be specified twice.
But I know that kwargs are not appreciated, so tell me if you want me to do this change or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

@schaubl this is a clear case to use kwargs, its not that the project dictates not using kwargs but in the case where the keyword arguments can be listed they can.
this is fine as is.

@Kami
Copy link
Member

Kami commented Apr 23, 2016

@schaubl Thanks.

I will review the changes again and if everything looks good go ahead and merge them intro trunk.

@asfgit asfgit closed this in eb497fa Apr 23, 2016
asfgit pushed a commit that referenced this pull request Apr 23, 2016
@Kami
Copy link
Member

Kami commented Apr 23, 2016

Merged, thanks!

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