Skip to content

Commit

Permalink
Strip single-quotes around regex for AWS
Browse files Browse the repository at this point in the history
It looks like GCE ignores them; we can't
  • Loading branch information
justinsb committed Mar 4, 2015
1 parent ce90836 commit 3012724
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/cloudprovider/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ import (
"io"
"net"
"regexp"
"strings"

"code.google.com/p/gcfg"
"github.com/mitchellh/goamz/aws"
"github.com/mitchellh/goamz/ec2"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"

"github.com/golang/glog"
)

type EC2 interface {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3012724

Please sign in to comment.