mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage|rackspace] cleanup formatting/style
This commit is contained in:
parent
d7438b98e7
commit
eb55083165
3 changed files with 16 additions and 20 deletions
|
@ -48,18 +48,18 @@ module Fog
|
|||
@enabled = false
|
||||
|
||||
if credentials['X-CDN-Management-Url']
|
||||
uri = URI.parse(credentials['X-CDN-Management-Url'])
|
||||
@host = uri.host
|
||||
@path = uri.path
|
||||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
||||
@enabled = true
|
||||
uri = URI.parse(credentials['X-CDN-Management-Url'])
|
||||
@host = uri.host
|
||||
@path = uri.path
|
||||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
||||
@enabled = true
|
||||
end
|
||||
end
|
||||
|
||||
def enabled?
|
||||
@enabled
|
||||
@enabled
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -56,19 +56,15 @@ module Fog
|
|||
requires :key
|
||||
connection.put_container(key)
|
||||
|
||||
# if user set cont as public but wed don't have a CDN connnection
|
||||
# then error out.
|
||||
if @public and !@connection.cdn
|
||||
raise(Fog::Storage::Rackspace::Error.new("Directory can not be set as :public without a CDN provided"))
|
||||
# if we set as public then set it and we sure we have connection.cdn
|
||||
# or it would have error out.
|
||||
elsif @public
|
||||
if @connection.cdn && @public
|
||||
# if public and CDN connection then update cdn to public
|
||||
@public_url = connection.cdn.put_container(key, 'X-CDN-Enabled' => 'True').headers['X-CDN-URI']
|
||||
# if we have cdn connectio but cont has not been public then let the
|
||||
# CDN knows about it
|
||||
elsif @connection.cdn
|
||||
elsif @connection.cdn && !@public
|
||||
connection.cdn.put_container(key, 'X-CDN-Enabled' => 'False')
|
||||
@public_url = nil
|
||||
elsif !@connection.cdn && @public
|
||||
# if public but no CDN connection then error
|
||||
raise(Fog::Storage::Rackspace::Error.new("Directory can not be set as :public without a CDN provided"))
|
||||
end
|
||||
true
|
||||
end
|
||||
|
|
|
@ -30,11 +30,11 @@ module Fog
|
|||
@cdn ||= Fog::CDN.new(
|
||||
:provider => 'Rackspace',
|
||||
:rackspace_api_key => @rackspace_api_key,
|
||||
:rackspace_auth_url => @rackspace_auth_url,
|
||||
:rackspace_auth_url => @rackspace_auth_url,
|
||||
:rackspace_username => @rackspace_username
|
||||
)
|
||||
if @cdn.enabled?
|
||||
return @cdn
|
||||
@cdn
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue