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

[LIBCLOUD-568] Fixing cross service OAuth scopes for Google Compute Engine / DNS / Storage #302

Closed
wants to merge 3 commits into
base: trunk
from

Conversation

Projects
None yet
3 participants
@erjohnso
Member

erjohnso commented May 30, 2014

Prior to this fix, a user could call "get_driver()" for GCE but authorization was only allowed for the "compute" scope. With the addition of the DNS module, users calling its "get_driver()" would only be authorized to the DNS service.

This change allows scopes to be set as keyword params in get_driver() (or via secrets.py) that get propagated down to the authorization connection class. The default behavior is to grant authorization via scopes to all supported google services (compute, storage, dns).

It should be noted that the storage authorization via oauth scopes is bogus, but sets the stage for future enhancements we expect to contribute over the summer.

@wrigri, @franckcuny - A review would be much appreciated!

@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso May 30, 2014

Member

Hmm... not sure what to do about those travis failures,

WARNING:test command found but not installed in testenv

I don't think it has anything to do with my changes and if it does, I'm at a loss on how to interpret the error.

Member

erjohnso commented May 30, 2014

Hmm... not sure what to do about those travis failures,

WARNING:test command found but not installed in testenv

I don't think it has anything to do with my changes and if it does, I'm at a loss on how to interpret the error.

Show outdated Hide outdated libcloud/common/google.py
@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Jun 3, 2014

Member

@Kami - I think this is good to go unless you want to hear from @wrigri or @franckcuny.

Member

erjohnso commented Jun 3, 2014

@Kami - I think this is good to go unless you want to hear from @wrigri or @franckcuny.

@wrigri

This comment has been minimized.

Show comment
Hide comment
@wrigri

wrigri Jun 3, 2014

Contributor

Looks good to me

Contributor

wrigri commented Jun 3, 2014

Looks good to me

@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Jun 9, 2014

Member

@Kami - I think this is all set now. :)

Member

erjohnso commented Jun 9, 2014

@Kami - I think this is all set now. :)

@asfgit asfgit closed this in e02fec6 Jun 9, 2014

@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Jun 9, 2014

Member

Thanks.

I've merged it into trunk with a minor fix - I've changed the default value for scopes attribute from [] to None and initialized empty list inside the function.

The problem is that default values for arguments are created at the time of the function definition. This means that if you would mutate scope argument inside the function, you would actually be mutating the default parameter value which is almost never something you would want.

Member

Kami commented Jun 9, 2014

Thanks.

I've merged it into trunk with a minor fix - I've changed the default value for scopes attribute from [] to None and initialized empty list inside the function.

The problem is that default values for arguments are created at the time of the function definition. This means that if you would mutate scope argument inside the function, you would actually be mutating the default parameter value which is almost never something you would want.

@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Jun 10, 2014

Member

Thank you @Kami, nice catch!

Member

erjohnso commented Jun 10, 2014

Thank you @Kami, nice catch!

@erjohnso erjohnso deleted the erjohnso:LIBCLOUD-568_google_oauth branch Oct 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment