mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #5056 from justinsb/ignore_regex_quotes
Strip single-quotes around regex for AWS
This commit is contained in:
commit
dff0bd1cbf
@ -21,6 +21,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"code.google.com/p/gcfg"
|
"code.google.com/p/gcfg"
|
||||||
"github.com/mitchellh/goamz/aws"
|
"github.com/mitchellh/goamz/aws"
|
||||||
@ -28,6 +29,8 @@ import (
|
|||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EC2 interface {
|
type EC2 interface {
|
||||||
@ -177,6 +180,11 @@ func (aws *AWSCloud) getInstancesByRegex(regex string) ([]string, error) {
|
|||||||
return []string{}, fmt.Errorf("no InstanceResp returned")
|
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)
|
re, err := regexp.Compile(regex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []string{}, err
|
return []string{}, err
|
||||||
|
Loading…
Reference in New Issue
Block a user