namespace the enhanced networking fixer appropriately.

This commit is contained in:
Matthew Hooker 2017-09-05 18:09:31 -07:00
parent 54c8f77be0
commit 1a4c309ad5
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
3 changed files with 22 additions and 22 deletions

View File

@ -20,19 +20,19 @@ var FixerOrder []string
func init() {
Fixers = map[string]Fixer{
"iso-md5": new(FixerISOMD5),
"createtime": new(FixerCreateTime),
"pp-vagrant-override": new(FixerVagrantPPOverride),
"virtualbox-gaattach": new(FixerVirtualBoxGAAttach),
"virtualbox-rename": new(FixerVirtualBoxRename),
"vmware-rename": new(FixerVMwareRename),
"parallels-headless": new(FixerParallelsHeadless),
"parallels-deprecations": new(FixerParallelsDeprecations),
"sshkeypath": new(FixerSSHKeyPath),
"sshdisableagent": new(FixerSSHDisableAgent),
"manifest-filename": new(FixerManifestFilename),
"amazon-shutdown_behavior": new(FixerAmazonShutdownBehavior),
"enhanced-networking": new(FixerEnhancedNetworking),
"iso-md5": new(FixerISOMD5),
"createtime": new(FixerCreateTime),
"pp-vagrant-override": new(FixerVagrantPPOverride),
"virtualbox-gaattach": new(FixerVirtualBoxGAAttach),
"virtualbox-rename": new(FixerVirtualBoxRename),
"vmware-rename": new(FixerVMwareRename),
"parallels-headless": new(FixerParallelsHeadless),
"parallels-deprecations": new(FixerParallelsDeprecations),
"sshkeypath": new(FixerSSHKeyPath),
"sshdisableagent": new(FixerSSHDisableAgent),
"manifest-filename": new(FixerManifestFilename),
"amazon-shutdown_behavior": new(FixerAmazonShutdownBehavior),
"amazon-enhanced-networking": new(FixerAmazonEnhancedNetworking),
}
FixerOrder = []string{
@ -48,6 +48,6 @@ func init() {
"sshdisableagent",
"manifest-filename",
"amazon-shutdown_behavior",
"enhanced-networking",
"amazon-enhanced-networking",
}
}

View File

@ -4,11 +4,11 @@ import (
"github.com/mitchellh/mapstructure"
)
// FixerEnhancedNetworking is a Fixer that replaces the "enhanced_networking" configuration key
// FixerAmazonEnhancedNetworking is a Fixer that replaces the "enhanced_networking" configuration key
// with the clearer "ena_support". This disambiguates ena_support from sriov_support.
type FixerEnhancedNetworking struct{}
type FixerAmazonEnhancedNetworking struct{}
func (FixerEnhancedNetworking) Fix(input map[string]interface{}) (map[string]interface{}, error) {
func (FixerAmazonEnhancedNetworking) Fix(input map[string]interface{}) (map[string]interface{}, error) {
// Our template type we'll use for this fixer only
type template struct {
Builders []map[string]interface{}
@ -40,6 +40,6 @@ func (FixerEnhancedNetworking) Fix(input map[string]interface{}) (map[string]int
return input, nil
}
func (FixerEnhancedNetworking) Synopsis() string {
func (FixerAmazonEnhancedNetworking) Synopsis() string {
return `Replaces "enhanced_networking" in builders with "ena_support"`
}

View File

@ -5,11 +5,11 @@ import (
"testing"
)
func TestFixerEnhancedNetworking_Impl(t *testing.T) {
var _ Fixer = new(FixerEnhancedNetworking)
func TestFixerAmazonEnhancedNetworking_Impl(t *testing.T) {
var _ Fixer = new(FixerAmazonEnhancedNetworking)
}
func TestFixerEnhancedNetworking(t *testing.T) {
func TestFixerAmazonEnhancedNetworking(t *testing.T) {
cases := []struct {
Input map[string]interface{}
Expected map[string]interface{}
@ -42,7 +42,7 @@ func TestFixerEnhancedNetworking(t *testing.T) {
}
for _, tc := range cases {
var f FixerEnhancedNetworking
var f FixerAmazonEnhancedNetworking
input := map[string]interface{}{
"builders": []map[string]interface{}{tc.Input},