refactor: remove unused attributes

This commit is contained in:
Marin Salinas 2019-04-05 16:06:17 -06:00 committed by Megan Marsh
parent 590bef0969
commit f28c3877e3
5 changed files with 12 additions and 38 deletions

View File

@ -108,11 +108,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
ForceDeregister: b.config.OMIForceDeregister,
},
&osccommon.StepSourceOMIInfo{
SourceOmi: b.config.SourceOmi,
EnableOMISriovNetSupport: b.config.OMISriovNetSupport,
EnableOMIENASupport: b.config.OMIENASupport,
OmiFilters: b.config.SourceOmiFilter,
OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used
SourceOmi: b.config.SourceOmi,
OmiFilters: b.config.SourceOmiFilter,
OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used
},
&osccommon.StepNetworkInfo{
NetId: b.config.NetId,
@ -177,10 +175,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
Skip: false,
DisableStopVm: b.config.DisableStopVm,
},
&osccommon.StepUpdateBSUBackedVm{
EnableAMISriovNetSupport: b.config.OMISriovNetSupport,
EnableAMIENASupport: b.config.OMIENASupport,
},
&osccommon.StepDeregisterOMI{
AccessConfig: &b.config.AccessConfig,
ForceDeregister: b.config.OMIForceDeregister,

View File

@ -89,14 +89,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("no volume with name '%s' is found", b.config.RootDevice.SourceDeviceName))
}
//TODO: Chek if this is necessary
if b.config.IsSpotVm() && ((b.config.OMIENASupport != nil && *b.config.OMIENASupport) || b.config.OMISriovNetSupport) {
errs = packer.MultiErrorAppend(errs,
fmt.Errorf("Spot instances do not support modification, which is required "+
"when either `ena_support` or `sriov_support` are set. Please ensure "+
"you use an OMI that already has either SR-IOV or ENA enabled."))
}
if errs != nil && len(errs.Errors) > 0 {
return nil, errs
}
@ -139,11 +131,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
ForceDeregister: b.config.OMIForceDeregister,
},
&osccommon.StepSourceOMIInfo{
SourceOmi: b.config.SourceOmi,
EnableOMISriovNetSupport: b.config.OMISriovNetSupport,
EnableOMIENASupport: b.config.OMIENASupport,
OmiFilters: b.config.SourceOmiFilter,
OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used
SourceOmi: b.config.SourceOmi,
OmiFilters: b.config.SourceOmiFilter,
OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used
},
&osccommon.StepNetworkInfo{
NetId: b.config.NetId,
@ -208,10 +198,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
Skip: false,
DisableStopVm: b.config.DisableStopVm,
},
&osccommon.StepUpdateBSUBackedVm{
EnableAMISriovNetSupport: b.config.OMISriovNetSupport,
EnableAMIENASupport: b.config.OMIENASupport,
},
&StepSnapshotVolumes{
LaunchDevices: launchDevices,
},

View File

@ -228,11 +228,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
if !b.config.FromScratch {
steps = append(steps,
&osccommon.StepSourceOMIInfo{
SourceOmi: b.config.SourceOMI,
EnableOMISriovNetSupport: b.config.OMISriovNetSupport,
EnableOMIENASupport: b.config.OMIENASupport,
OmiFilters: b.config.SourceOMIFilter,
OMIVirtType: b.config.OMIVirtType,
SourceOmi: b.config.SourceOMI,
OmiFilters: b.config.SourceOMIFilter,
OMIVirtType: b.config.OMIVirtType,
},
&StepCheckRootDevice{},
)

View File

@ -19,8 +19,6 @@ type OMIConfig struct {
OMIRegions []string `mapstructure:"omi_regions"`
OMISkipRegionValidation bool `mapstructure:"skip_region_validation"`
OMITags TagMap `mapstructure:"tags"`
OMIENASupport *bool `mapstructure:"ena_support"`
OMISriovNetSupport bool `mapstructure:"sriov_support"`
OMIForceDeregister bool `mapstructure:"force_deregister"`
OMIForceDeleteSnapshot bool `mapstructure:"force_delete_snapshot"`
SnapshotTags TagMap `mapstructure:"snapshot_tags"`

View File

@ -18,11 +18,9 @@ import (
// Produces:
// source_image *oapi.Image - the source OMI info
type StepSourceOMIInfo struct {
SourceOmi string
EnableOMISriovNetSupport bool
EnableOMIENASupport *bool
OMIVirtType string
OmiFilters OmiFilterOptions
SourceOmi string
OMIVirtType string
OmiFilters OmiFilterOptions
}
type imageSort []oapi.Image