Skip to content

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.#258
fcuny wants to merge 1 commit intoapache:trunkfrom
fcuny:gce-copy-image

Conversation

@fcuny
Copy link
Copy Markdown

@fcuny fcuny commented Mar 10, 2014

The ex_copy_image method allow to copy an image from a Google Cloud
Storage URL in the specified project.

I'm going to need this to implement this part in Ansible soon.

Thanks.

@Kami
Copy link
Copy Markdown
Member

Kami commented Mar 10, 2014

/cc @wrigri

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.)

@wrigri
Copy link
Copy Markdown
Contributor

wrigri commented Mar 10, 2014

Looks good overall. A couple of minor things, but otherwise it seems like a good addition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/starts/start/

@fcuny
Copy link
Copy Markdown
Author

fcuny commented Mar 10, 2014

Thanks @wrigri, I'll update this patch later today.

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.

Python strings are immutable and .replace returns a new string. This means you should do:

url = url.replace('gs://', 'https://storage.googleapis.com/', 1)

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.

Besides that, LGTM.

The `ex_copy_image` method allow to copy an image from a Google Cloud
Storage URL in the specified project.
@asfgit asfgit closed this in 2434ef5 Mar 17, 2014
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