Add method ex_copy_image to the GCE driver.#258
Closed
fcuny wants to merge 1 commit intoapache:trunkfrom
fcuny:gce-copy-image
Closed
Add method ex_copy_image to the GCE driver.#258fcuny wants to merge 1 commit intoapache:trunkfrom fcuny:gce-copy-image
ex_copy_image to the GCE driver.#258fcuny wants to merge 1 commit intoapache:trunkfrom
fcuny:gce-copy-image
Conversation
Member
|
/cc @wrigri |
libcloud/compute/drivers/gce.py
Outdated
Contributor
There was a problem hiding this comment.
The URL should be 'https:' not 'http:'
Also, the [len('gs://'):] construct seems overly complicated. Maybe something like this instead?
url.replace('gs://', 'https://storage.googleapis.com/', 1)
(I can't imagine what a url would look like that had more than one 'gs://' in it, but added the '1' to the parameters just in case.)
Contributor
|
Looks good overall. A couple of minor things, but otherwise it seems like a good addition. |
libcloud/compute/drivers/gce.py
Outdated
Author
|
Thanks @wrigri, I'll update this patch later today. |
libcloud/compute/drivers/gce.py
Outdated
Member
There was a problem hiding this comment.
Python strings are immutable and .replace returns a new string. This means you should do:
url = url.replace('gs://', 'https://storage.googleapis.com/', 1)The `ex_copy_image` method allow to copy an image from a Google Cloud Storage URL in the specified project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ex_copy_imagemethod allow to copy an image from a Google CloudStorage URL in the specified project.
I'm going to need this to implement this part in Ansible soon.
Thanks.