provisioner(converge): remove version validation
This commit is contained in:
parent
18425c45d0
commit
64ebd3af8d
|
@ -12,16 +12,12 @@ import (
|
|||
|
||||
"encoding/json"
|
||||
|
||||
"regexp"
|
||||
|
||||
"github.com/mitchellh/packer/common"
|
||||
"github.com/mitchellh/packer/helper/config"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"github.com/mitchellh/packer/template/interpolate"
|
||||
)
|
||||
|
||||
var versionRegex = regexp.MustCompile(`^[\.\-\da-zA-Z]*$`)
|
||||
|
||||
// Config for Converge provisioner
|
||||
type Config struct {
|
||||
common.PackerConfig `mapstructure:",squash"`
|
||||
|
@ -94,11 +90,6 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
|||
p.config.BootstrapCommand = "curl -s https://get.converge.sh | sh {{if ne .Version \"\"}}-s -- -v {{.Version}}{{end}}"
|
||||
}
|
||||
|
||||
// validate version
|
||||
if !versionRegex.Match([]byte(p.config.Version)) {
|
||||
return fmt.Errorf("Invalid Converge version %q specified. Valid versions include only letters, numbers, dots, and dashes", p.config.Version)
|
||||
}
|
||||
|
||||
// validate sources and destinations
|
||||
for i, dir := range p.config.ModuleDirs {
|
||||
if dir.Source == "" {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package converge
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/mitchellh/packer/packer"
|
||||
|
@ -76,19 +75,6 @@ func TestProvisionerPrepare(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("validate", func(t *testing.T) {
|
||||
t.Run("bad version", func(t *testing.T) {
|
||||
var p Provisioner
|
||||
config := testConfig()
|
||||
config["version"] = "bad version with spaces"
|
||||
|
||||
err := p.Prepare(config)
|
||||
if err == nil {
|
||||
t.Error("expected error")
|
||||
} else if !strings.HasPrefix(err.Error(), "Invalid Converge version") {
|
||||
t.Errorf("expected error starting with \"Invalid Converge version\". Got: %s", err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("module dir", func(t *testing.T) {
|
||||
t.Run("missing source", func(t *testing.T) {
|
||||
var p Provisioner
|
||||
|
|
Loading…
Reference in New Issue