зеркало из https://github.com/github/fog.git
Deprecate hp_account_id to use hp_access_key instead.
This commit is contained in:
Родитель
8fca81df40
Коммит
72a5fcede5
|
@ -46,7 +46,7 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
|
|||
:go_grid_shared_secret:
|
||||
:google_storage_access_key_id:
|
||||
:google_storage_secret_access_key:
|
||||
:hp_account_id:
|
||||
:hp_access_key:
|
||||
:hp_secret_key:
|
||||
:hp_tenant_id:
|
||||
:hp_avl_zone:
|
||||
|
|
|
@ -19,10 +19,14 @@ module Fog
|
|||
data = nil
|
||||
message = nil
|
||||
else
|
||||
data = Fog::JSON.decode(error.response.body)
|
||||
message = data['message']
|
||||
if message.nil? and !data.values.first.nil?
|
||||
message = data.values.first['message']
|
||||
begin
|
||||
data = Fog::JSON.decode(error.response.body)
|
||||
message = data['message']
|
||||
if message.nil? and !data.values.first.nil?
|
||||
message = data.values.first['message']
|
||||
end
|
||||
rescue MultiJson::DecodeError
|
||||
message = error.response.body #### body is not in JSON format, so just return as is
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -73,13 +77,13 @@ module Fog
|
|||
@user_agent = options[:user_agent]
|
||||
set_user_agent_header(connection_options, "hpfog v1/#{Fog::HP::VERSION}", @user_agent)
|
||||
connection = Fog::Connection.new(service_url, false, connection_options)
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
response = connection.request({
|
||||
:expects => [200, 204],
|
||||
:headers => {
|
||||
'X-Auth-Key' => @hp_secret_key,
|
||||
'X-Auth-User' => @hp_account_id
|
||||
'X-Auth-User' => @hp_access_key
|
||||
},
|
||||
:host => @host,
|
||||
:port => @port,
|
||||
|
@ -120,7 +124,7 @@ module Fog
|
|||
### Implement HP Control Services Authentication services ###
|
||||
# Get the style of auth credentials passed, defaults to access/secret key style
|
||||
@hp_use_upass_auth_style = options[:hp_use_upass_auth_style] || false
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
@hp_tenant_id = options[:hp_tenant_id]
|
||||
@hp_service_type = options[:hp_service_type]
|
||||
|
@ -132,7 +136,7 @@ module Fog
|
|||
request_body = {
|
||||
'auth' => {
|
||||
'apiAccessKeyCredentials' => {
|
||||
'accessKey' => "#{@hp_account_id}",
|
||||
'accessKey' => "#{@hp_access_key}",
|
||||
'secretKey' => "#{@hp_secret_key}"
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +146,7 @@ module Fog
|
|||
request_body = {
|
||||
'auth' => {
|
||||
'passwordCredentials' => {
|
||||
'username' => "#{@hp_account_id}",
|
||||
'username' => "#{@hp_access_key}",
|
||||
'password' => "#{@hp_secret_key}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
0.0.19 18/01/2013
|
||||
=================
|
||||
- update Block Storage namespace to be Fog::HP::BlockStorage
|
||||
- merge with upstream fog v1.8.0
|
||||
- deprecate hp_account_id to use hp_access_key instead
|
||||
|
||||
0.0.18 12/04/2012
|
||||
=================
|
||||
- add support for controlled access via cross-tenant ACLs
|
||||
|
|
|
@ -4,14 +4,15 @@ module Fog
|
|||
module HP
|
||||
class BlockStorage < Fog::Service
|
||||
|
||||
requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone
|
||||
requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri
|
||||
recognizes :persistent, :connection_options
|
||||
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
||||
recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
|
||||
|
||||
secrets :hp_secret_key
|
||||
|
||||
model_path 'fog/hp/models/block_storage'
|
||||
model_path 'fog/hp/models/block_storage'
|
||||
model :volume
|
||||
collection :volumes
|
||||
collection :bootable_volumes
|
||||
|
@ -37,7 +38,7 @@ module Fog
|
|||
def compute
|
||||
@compute ||= Fog::Compute.new(
|
||||
:provider => 'HP',
|
||||
:hp_account_id => @hp_account_id,
|
||||
:hp_access_key => @hp_access_key,
|
||||
:hp_secret_key => @hp_secret_key,
|
||||
:hp_auth_uri => @hp_auth_uri,
|
||||
:hp_tenant_id => @hp_tenant_id,
|
||||
|
@ -65,15 +66,23 @@ module Fog
|
|||
end
|
||||
|
||||
def initialize(options={})
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
@hp_access_key = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data[@hp_account_id]
|
||||
self.class.data[@hp_access_key]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@hp_account_id)
|
||||
self.class.data.delete(@hp_access_key)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -82,8 +91,16 @@ module Fog
|
|||
include Utils
|
||||
|
||||
def initialize(options={})
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
options[:hp_access_key] = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
@hp_auth_uri = options[:hp_auth_uri]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
||||
|
|
|
@ -5,10 +5,11 @@ module Fog
|
|||
module CDN
|
||||
class HP < Fog::Service
|
||||
|
||||
requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone
|
||||
requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri, :hp_cdn_uri
|
||||
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
||||
recognizes :persistent, :connection_options
|
||||
recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
|
||||
|
||||
secrets :hp_secret_key
|
||||
|
||||
|
@ -41,15 +42,23 @@ module Fog
|
|||
end
|
||||
|
||||
def initialize(options={})
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
@hp_access_key = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data[@hp_account_id]
|
||||
self.class.data[@hp_access_key]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@hp_account_id)
|
||||
self.class.data.delete(@hp_access_key)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -58,11 +67,22 @@ module Fog
|
|||
include Utils
|
||||
|
||||
def initialize(options={})
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
options[:hp_access_key] = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
||||
auth_version = options[:hp_auth_version] || :v2
|
||||
### Pass the service name for object storage to the authentication call
|
||||
options[:hp_service_type] = "CDN"
|
||||
@hp_tenant_id = options[:hp_tenant_id]
|
||||
|
||||
### Make the authentication call
|
||||
if (auth_version == :v2)
|
||||
|
|
|
@ -5,10 +5,11 @@ module Fog
|
|||
module Compute
|
||||
class HP < Fog::Service
|
||||
|
||||
requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri, :hp_servicenet
|
||||
requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri
|
||||
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
||||
recognizes :persistent, :connection_options
|
||||
recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
|
||||
|
||||
secrets :hp_secret_key
|
||||
|
||||
|
@ -150,15 +151,23 @@ module Fog
|
|||
end
|
||||
|
||||
def initialize(options={})
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
@hp_access_key = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data[@hp_account_id]
|
||||
self.class.data[@hp_access_key]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@hp_account_id)
|
||||
self.class.data.delete(@hp_access_key)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -167,9 +176,16 @@ module Fog
|
|||
include Utils
|
||||
|
||||
def initialize(options={})
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
options[:hp_access_key] = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
@hp_servicenet = options[:hp_servicenet]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
||||
auth_version = options[:hp_auth_version] || :v2
|
||||
|
|
|
@ -5,10 +5,11 @@ module Fog
|
|||
module Storage
|
||||
class HP < Fog::Service
|
||||
|
||||
requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri, :hp_servicenet, :hp_cdn_ssl, :hp_cdn_uri
|
||||
requires :hp_secret_key, :hp_tenant_id, :hp_avl_zone
|
||||
recognizes :hp_auth_uri, :hp_cdn_ssl, :hp_cdn_uri
|
||||
recognizes :persistent, :connection_options
|
||||
recognizes :hp_use_upass_auth_style, :hp_auth_version, :user_agent
|
||||
recognizes :hp_access_key, :hp_account_id # :hp_account_id is deprecated use hp_access_key instead
|
||||
|
||||
secrets :hp_secret_key
|
||||
|
||||
|
@ -47,7 +48,7 @@ module Fog
|
|||
unless @hp_cdn_uri.nil?
|
||||
@cdn ||= Fog::CDN.new(
|
||||
:provider => 'HP',
|
||||
:hp_account_id => @hp_account_id,
|
||||
:hp_access_key => @hp_access_key,
|
||||
:hp_secret_key => @hp_secret_key,
|
||||
:hp_auth_uri => @hp_auth_uri,
|
||||
:hp_cdn_uri => @hp_cdn_uri,
|
||||
|
@ -168,7 +169,7 @@ module Fog
|
|||
string_to_sign = "#{method}\n#{expires}\n#{sig_path}"
|
||||
signed_string = Digest::HMAC.hexdigest(string_to_sign, @hp_secret_key, Digest::SHA1)
|
||||
|
||||
signature = @hp_tenant_id.to_s + ":" + @hp_account_id.to_s + ":" + signed_string
|
||||
signature = @hp_tenant_id.to_s + ":" + @hp_access_key.to_s + ":" + signed_string
|
||||
signature = Fog::HP.escape(signature)
|
||||
|
||||
# generate the temp url using the signature and expiry
|
||||
|
@ -201,17 +202,25 @@ module Fog
|
|||
|
||||
def initialize(options={})
|
||||
require 'mime/types'
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
@hp_access_key = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
@hp_tenant_id = options[:hp_tenant_id]
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data[@hp_account_id]
|
||||
self.class.data[@hp_access_key]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@hp_account_id)
|
||||
self.class.data.delete(@hp_access_key)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -222,8 +231,16 @@ module Fog
|
|||
|
||||
def initialize(options={})
|
||||
require 'mime/types'
|
||||
# deprecate hp_account_id
|
||||
if options[:hp_account_id]
|
||||
Fog::Logger.deprecation(":hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
options[:hp_access_key] = options.delete(:hp_account_id)
|
||||
end
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
unless @hp_access_key
|
||||
raise ArgumentError.new("Missing required arguments: hp_access_key. :hp_account_id is deprecated, please use :hp_access_key instead.")
|
||||
end
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
@hp_account_id = options[:hp_account_id]
|
||||
@hp_auth_uri = options[:hp_auth_uri]
|
||||
@hp_cdn_ssl = options[:hp_cdn_ssl]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
|
|
|
@ -39,7 +39,7 @@ if Fog.mock?
|
|||
:go_grid_shared_secret => 'go_grid_shared_secret',
|
||||
:google_storage_access_key_id => 'google_storage_access_key_id',
|
||||
:google_storage_secret_access_key => 'google_storage_secret_access_key',
|
||||
:hp_account_id => 'hp_account_id',
|
||||
:hp_access_key => 'hp_access_key',
|
||||
:hp_secret_key => 'hp_secret_key',
|
||||
:hp_tenant_id => 'hp_tenant_id',
|
||||
:hp_avl_zone => 'hp_avl_zone',
|
||||
|
|
Загрузка…
Ссылка в новой задаче