Skip to content
This repository

add support for HP availability zone az-3.region-a.geo-1 #903

Closed
wants to merge 1 commit into from

4 participants

Matt Ray Rupak Ganguly Noel Geren Wesley Beary
Matt Ray
mattray commented May 11, 2012

missing from the 'HP' provider in Fog.

Rupak Ganguly
Collaborator
rupakg commented May 11, 2012

Will do in my next update.

Noel Geren

You can use this monkey patch until an actual fix is committed. Not only does it support az-3, but it's order agnostic, where-as the existing implementation expects az-1..3 to be in a specific order. This puppy will work regardless of the object order sent back in the auth response from HP:

module Fog
  module HP

    class << self
      alias :original_get_endpoint_from_catalog :get_endpoint_from_catalog      
      def get_endpoint_from_catalog(service_catalog, service_type, avl_zone)
        regions = { :az1 => "az-1.region-a.geo-1", :az2 => "az-2.region-a.geo-1", :az3 => "az-3.region-a.geo-1" }
        if service_catalog
          service_item = service_catalog.select {|s| s["type"] == service_type}.first
          if service_item then
            endpoints = service_item[ "endpoints" ]
            if !endpoints.nil? then
              endpoint_url = nil
              endpoints.each do |ep|
                region = regions[ avl_zone ]
                if ep[ "region" ].eql?( regions[ avl_zone ] ) then
                  endpoint_url = ep[ "publicURL" ]
                end
                return endpoint_url if !endpoint_url.nil?
              end
            end
          end
          raise "Unable to retrieve endpoint service url from service catalog." if endpoint_url.nil?
        else
          raise "Unable to parse service catalog."
        end
      end
    end

  end
end
Wesley Beary
Owner

@ngeren - thanks for the update, hopefully we can get the updated stuff soon.

Rupak Ganguly
Collaborator

Fixed in #1505. /cc @ngeren @mattray

Rupak Ganguly rupakg closed this January 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 11, 2012
Matt Ray add HP az-3.region-a.geo-1 c624e69
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  lib/fog/hp.rb
2  lib/fog/hp.rb
@@ -184,6 +184,8 @@ def self.get_endpoint_from_catalog(service_catalog, service_type, avl_zone)
184 184
             endpoint_url = service_item['endpoints'][0]['publicURL'] if service_item['endpoints'][0]
185 185
           elsif avl_zone == :az2
186 186
             endpoint_url = service_item['endpoints'][1]['publicURL'] if service_item['endpoints'][1]
  187
+          elsif avl_zone == :az3
  188
+            endpoint_url = service_item['endpoints'][2]['publicURL'] if service_item['endpoints'][2]
187 189
           end
188 190
           raise "Unable to retrieve endpoint service url from service catalog." if endpoint_url.nil?
189 191
           return endpoint_url
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.