From 3012724d137aacc35c7f61e95a38e556f64f4fd1 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Wed, 4 Mar 2015 16:52:49 -0500 Subject: [PATCH] Strip single-quotes around regex for AWS It looks like GCE ignores them; we can't --- pkg/cloudprovider/aws/aws.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/cloudprovider/aws/aws.go b/pkg/cloudprovider/aws/aws.go index 41e82078651..511376962ec 100644 --- a/pkg/cloudprovider/aws/aws.go +++ b/pkg/cloudprovider/aws/aws.go @@ -21,6 +21,7 @@ import ( "io" "net" "regexp" + "strings" "code.google.com/p/gcfg" "github.com/mitchellh/goamz/aws" @@ -28,6 +29,8 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider" + + "github.com/golang/glog" ) type EC2 interface { @@ -177,6 +180,11 @@ func (aws *AWSCloud) getInstancesByRegex(regex string) ([]string, error) { return []string{}, fmt.Errorf("no InstanceResp returned") } + if strings.HasPrefix(regex, "'") && strings.HasSuffix(regex, "'") { + glog.Infof("Stripping quotes around regex (%s)", regex) + regex = regex[1 : len(regex)-1] + } + re, err := regexp.Compile(regex) if err != nil { return []string{}, err