From 44200e7a04e143b91ee2c77c04f91da20051b104 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Sat, 12 Mar 2016 18:18:53 -0800 Subject: [PATCH] Case-insensitive Azure Resource Provider matching Signed-off-by: Ahmet Alp Balkan --- drivers/azure/azureutil/azureutil.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/azure/azureutil/azureutil.go b/drivers/azure/azureutil/azureutil.go index 9c7e16e436..94f3e29d2b 100644 --- a/drivers/azure/azureutil/azureutil.go +++ b/drivers/azure/azureutil/azureutil.go @@ -53,7 +53,8 @@ func New(env azure.Environment, subsID string, auth autorest.Authorizer) *AzureC } // RegisterResourceProviders registers current subscription to the specified -// resource provider namespaces if they are not already registered. +// resource provider namespaces if they are not already registered. Namespaces +// are case-insensitive. func (a AzureClient) RegisterResourceProviders(namespaces ...string) error { l, err := a.providersClient().List(nil) if err != nil { @@ -65,11 +66,11 @@ func (a AzureClient) RegisterResourceProviders(namespaces ...string) error { m := make(map[string]bool) for _, p := range *l.Value { - m[to.String(p.Namespace)] = to.String(p.RegistrationState) == "Registered" + m[strings.ToLower(to.String(p.Namespace))] = to.String(p.RegistrationState) == "Registered" } for _, ns := range namespaces { - registered, ok := m[ns] + registered, ok := m[strings.ToLower(ns)] if !ok { return fmt.Errorf("Unknown resource provider %q", ns) }