Skip to content

Instantly share code, notes, and snippets.

@benjohnson77
Last active December 23, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjohnson77/6680086 to your computer and use it in GitHub Desktop.
Save benjohnson77/6680086 to your computer and use it in GitHub Desktop.
transferring 2TB of data from Rackspace cloud to Google Storage
def find_container(container_name, obj = nil)
container_info = requested_container_info(container_name)
container_name = clean_container_name(container_name)
parts = [prefix]
parts << container_name unless container_name == 'default'
name = parts.compact.join('-')
# NOTE: getting the container creates it if it does not exist. even
# though name doesn't access the container instance stored here, we
# need to leave this call here so the container will be created.
container = attempt(RETRY_THRESHOLD, :get_container!, name, container_name)
case container_info
when :container
raise "Failed to fetch container: #{name}" unless container
container
when :name
name
when :url
puts container_base_url
mappings.get(name) || mappings.set(name, container).try(:cdn_url)
when :url_ssl
mappings.get(name, true) || mappings.set(name, container).cdn_ssl_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment