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

[google compute] Add License resource #420

Closed
wants to merge 1 commit into
base: trunk
from

Conversation

Projects
None yet
2 participants
@erjohnso
Member

erjohnso commented Dec 19, 2014

Adds Licenses[1] support to the GCE driver to further improve full API coverage.

[1] https://cloud.google.com/compute/docs/reference/latest/licenses

Show outdated Hide outdated libcloud/compute/drivers/gce.py
self.name = name
self.driver = driver
self.charges_use_fee = charges_use_fee
self.extra = extra

This comment has been minimized.

@Kami

Kami Dec 19, 2014

Member

extra = extra or {}

@Kami

Kami Dec 19, 2014

Member

extra = extra or {}

Show outdated Hide outdated libcloud/compute/drivers/gce.py
selfLink_parts = license.split('/')
license_project = selfLink_parts[6]
license_name = selfLink_parts[-1]
extra['licenses'].append(self.ex_get_license(license_project,

This comment has been minimized.

@Kami

Kami Dec 19, 2014

Member

To make code easier to read, follow and update, please prefer using keyword arguments over regular arguments.

@Kami

Kami Dec 19, 2014

Member

To make code easier to read, follow and update, please prefer using keyword arguments over regular arguments.

Show outdated Hide outdated libcloud/compute/drivers/gce.py
@@ -4336,7 +4380,13 @@ def _to_snapshot(self, snapshot):
if 'storageBytesStatus' in snapshot:
extra['storageBytesStatus'] = snapshot['storageBytesStatus']
if 'licenses' in snapshot:
extra['licenses'] = snapshot['licenses']
extra['licenses'] = []
for license in snapshot['licenses']:

This comment has been minimized.

@Kami

Kami Dec 19, 2014

Member

Looks like this chunk of code is repeated in two place, might be worth refactoring it in a re-usable method :)

@Kami

Kami Dec 19, 2014

Member

Looks like this chunk of code is repeated in two place, might be worth refactoring it in a re-usable method :)

@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Dec 21, 2014

Member

Thanks @Kami. Addressed your feedback on this, so I'll go ahead and do the merge upstream once Travis gives the OK.

Member

erjohnso commented Dec 21, 2014

Thanks @Kami. Addressed your feedback on this, so I'll go ahead and do the merge upstream once Travis gives the OK.

@asfgit asfgit closed this in 0486f77 Dec 21, 2014

@erjohnso erjohnso deleted the erjohnso:GCE_Licenses branch Jan 5, 2015

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