mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Don't call methods on a non-enabled CDN.
This commit is contained in:
parent
58b3f0d0e0
commit
ea1dd6c2e4
3 changed files with 13 additions and 11 deletions
|
@ -35,6 +35,12 @@ module Fog
|
|||
"X-Trans-Id"
|
||||
end
|
||||
|
||||
# Returns true if CDN service is enabled
|
||||
# @return [Boolean]
|
||||
def enabled?
|
||||
@enabled
|
||||
end
|
||||
|
||||
def endpoint_uri(service_endpoint_url=nil)
|
||||
@uri = super(@rackspace_cdn_url || service_endpoint_url, :rackspace_cdn_url)
|
||||
end
|
||||
|
@ -98,6 +104,7 @@ module Fog
|
|||
|
||||
def initialize(options={})
|
||||
@rackspace_username = options[:rackspace_username]
|
||||
@enabled = false
|
||||
end
|
||||
|
||||
def data
|
||||
|
@ -137,12 +144,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
# Returns true if CDN service is enabled
|
||||
# @return [Boolean]
|
||||
def enabled?
|
||||
@enabled
|
||||
end
|
||||
|
||||
# Resets CDN connection
|
||||
def reload
|
||||
@cdn_connection.reset
|
||||
|
|
|
@ -166,8 +166,11 @@ module Fog
|
|||
def save
|
||||
requires :key
|
||||
create_or_update_container
|
||||
raise Fog::Storage::Rackspace::Error.new("Directory can not be set as :public without a CDN provided") if public? && !cdn_enabled?
|
||||
@urls = service.cdn.publish_container(self, public?)
|
||||
if cdn_enabled?
|
||||
@urls = service.cdn.publish_container(self, public?)
|
||||
else
|
||||
raise Fog::Storage::Rackspace::Error.new("Directory can not be set as :public without a CDN provided") if public?
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
Shindo.tests('Fog::Storage[:rackspace] | object requests', ["rackspace"]) do
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory = Fog::Storage[:rackspace].directories.create(:key => 'fogobjecttests')
|
||||
end
|
||||
@directory = Fog::Storage[:rackspace].directories.create(:key => 'fogobjecttests')
|
||||
|
||||
module RackspaceStorageHelpers
|
||||
def override_path(path)
|
||||
|
|
Loading…
Reference in a new issue