lib/fog/hp/network.rb in fog-1.23.0 vs lib/fog/hp/network.rb in fog-1.24.0
- old
+ new
@@ -123,19 +123,20 @@
@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)
auth_version = options[:hp_auth_version] || :v2
### Pass the service name for network to the authentication call
- options[:hp_service_type] ||= "Networking"
+ options[:hp_service_type] ||= "network"
@hp_tenant_id = options[:hp_tenant_id]
@hp_avl_zone = options[:hp_avl_zone]
### Make the authentication call
if (auth_version == :v2)
# Call the control services authentication
credentials = Fog::HP.authenticate_v2(options, @connection_options)
# the CS service catalog returns the network endpoint
+
@hp_network_uri = credentials[:endpoint_url]
@credentials = credentials
else
# Call the legacy v1.0/v1.1 authentication
credentials = Fog::HP.authenticate_v1(options, @connection_options)
@@ -150,25 +151,32 @@
@host = uri.host
@path = uri.path
@port = uri.port
@scheme = uri.scheme
+
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end
def reload
@connection.reset
end
def request(params, parse_json = true, &block)
begin
+ if @path == "/"
+ #helion network @path is "/"
+ @calculated_path = "v2.0/#{params[:path]}"
+ else
+ @calculated_path = "#{@path}/v2.0/#{params[:path]}"
+ end
response = @connection.request(params.merge!({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
- :path => "#{@path}/v2.0/#{params[:path]}"
+ :path => @calculated_path
}), &block)
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
Fog::HP::Network::NotFound.slurp(error)