chore: removed API attribute

This commit is contained in:
PacoDw 2020-08-18 13:52:49 -05:00
parent 7d8f28e1a3
commit 43e9d43ebd
8 changed files with 2 additions and 27 deletions

View File

@ -114,7 +114,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
&osccommon.StepPreValidate{
DestOmiName: b.config.OMIName,
ForceDeregister: b.config.OMIForceDeregister,
API: b.config.AccessConfig.API,
},
&osccommon.StepSourceOMIInfo{
SourceOmi: b.config.SourceOmi,

View File

@ -27,7 +27,6 @@ type FlatConfig struct {
SkipValidation *bool `mapstructure:"skip_region_validation" cty:"skip_region_validation" hcl:"skip_region_validation"`
SkipMetadataApiCheck *bool `mapstructure:"skip_metadata_api_check" cty:"skip_metadata_api_check" hcl:"skip_metadata_api_check"`
Token *string `mapstructure:"token" cty:"token" hcl:"token"`
API *string `mapstructure:"api" cty:"api" hcl:"api"`
OMIName *string `mapstructure:"omi_name" cty:"omi_name" hcl:"omi_name"`
OMIDescription *string `mapstructure:"omi_description" cty:"omi_description" hcl:"omi_description"`
OMIVirtType *string `mapstructure:"omi_virtualization_type" cty:"omi_virtualization_type" hcl:"omi_virtualization_type"`
@ -149,7 +148,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"skip_region_validation": &hcldec.AttrSpec{Name: "skip_region_validation", Type: cty.Bool, Required: false},
"skip_metadata_api_check": &hcldec.AttrSpec{Name: "skip_metadata_api_check", Type: cty.Bool, Required: false},
"token": &hcldec.AttrSpec{Name: "token", Type: cty.String, Required: false},
"api": &hcldec.AttrSpec{Name: "api", Type: cty.String, Required: false},
"omi_name": &hcldec.AttrSpec{Name: "omi_name", Type: cty.String, Required: false},
"omi_description": &hcldec.AttrSpec{Name: "omi_description", Type: cty.String, Required: false},
"omi_virtualization_type": &hcldec.AttrSpec{Name: "omi_virtualization_type", Type: cty.String, Required: false},

View File

@ -47,8 +47,7 @@ const testBuilderAccBasic = `
"vm_type": "t2.micro",
"source_omi": "ami-abe953fa",
"ssh_username": "outscale",
"omi_name": "packer-test {{timestamp}}",
"api":"osc"
"omi_name": "packer-test {{timestamp}}"
}]
}
`

View File

@ -27,7 +27,6 @@ type FlatConfig struct {
SkipValidation *bool `mapstructure:"skip_region_validation" cty:"skip_region_validation" hcl:"skip_region_validation"`
SkipMetadataApiCheck *bool `mapstructure:"skip_metadata_api_check" cty:"skip_metadata_api_check" hcl:"skip_metadata_api_check"`
Token *string `mapstructure:"token" cty:"token" hcl:"token"`
API *string `mapstructure:"api" cty:"api" hcl:"api"`
AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address" hcl:"associate_public_ip_address"`
Subregion *string `mapstructure:"subregion_name" cty:"subregion_name" hcl:"subregion_name"`
BlockDurationMinutes *int64 `mapstructure:"block_duration_minutes" cty:"block_duration_minutes" hcl:"block_duration_minutes"`
@ -150,7 +149,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"skip_region_validation": &hcldec.AttrSpec{Name: "skip_region_validation", Type: cty.Bool, Required: false},
"skip_metadata_api_check": &hcldec.AttrSpec{Name: "skip_metadata_api_check", Type: cty.Bool, Required: false},
"token": &hcldec.AttrSpec{Name: "token", Type: cty.String, Required: false},
"api": &hcldec.AttrSpec{Name: "api", Type: cty.String, Required: false},
"associate_public_ip_address": &hcldec.AttrSpec{Name: "associate_public_ip_address", Type: cty.Bool, Required: false},
"subregion_name": &hcldec.AttrSpec{Name: "subregion_name", Type: cty.String, Required: false},
"block_duration_minutes": &hcldec.AttrSpec{Name: "block_duration_minutes", Type: cty.Number, Required: false},

View File

@ -66,7 +66,6 @@ type FlatConfig struct {
SkipValidation *bool `mapstructure:"skip_region_validation" cty:"skip_region_validation" hcl:"skip_region_validation"`
SkipMetadataApiCheck *bool `mapstructure:"skip_metadata_api_check" cty:"skip_metadata_api_check" hcl:"skip_metadata_api_check"`
Token *string `mapstructure:"token" cty:"token" hcl:"token"`
API *string `mapstructure:"api" cty:"api" hcl:"api"`
AssociatePublicIpAddress *bool `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address" hcl:"associate_public_ip_address"`
Subregion *string `mapstructure:"subregion_name" cty:"subregion_name" hcl:"subregion_name"`
BlockDurationMinutes *int64 `mapstructure:"block_duration_minutes" cty:"block_duration_minutes" hcl:"block_duration_minutes"`
@ -173,7 +172,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"skip_region_validation": &hcldec.AttrSpec{Name: "skip_region_validation", Type: cty.Bool, Required: false},
"skip_metadata_api_check": &hcldec.AttrSpec{Name: "skip_metadata_api_check", Type: cty.Bool, Required: false},
"token": &hcldec.AttrSpec{Name: "token", Type: cty.String, Required: false},
"api": &hcldec.AttrSpec{Name: "api", Type: cty.String, Required: false},
"associate_public_ip_address": &hcldec.AttrSpec{Name: "associate_public_ip_address", Type: cty.Bool, Required: false},
"subregion_name": &hcldec.AttrSpec{Name: "subregion_name", Type: cty.String, Required: false},
"block_duration_minutes": &hcldec.AttrSpec{Name: "block_duration_minutes", Type: cty.Number, Required: false},

View File

@ -41,7 +41,6 @@ type FlatConfig struct {
SecretKey *string `mapstructure:"secret_key" cty:"secret_key" hcl:"secret_key"`
SkipMetadataApiCheck *bool `mapstructure:"skip_metadata_api_check" cty:"skip_metadata_api_check" hcl:"skip_metadata_api_check"`
Token *string `mapstructure:"token" cty:"token" hcl:"token"`
API *string `mapstructure:"api" cty:"api" hcl:"api"`
ChrootMounts [][]string `mapstructure:"chroot_mounts" cty:"chroot_mounts" hcl:"chroot_mounts"`
CommandWrapper *string `mapstructure:"command_wrapper" cty:"command_wrapper" hcl:"command_wrapper"`
CopyFiles []string `mapstructure:"copy_files" cty:"copy_files" hcl:"copy_files"`
@ -104,7 +103,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"secret_key": &hcldec.AttrSpec{Name: "secret_key", Type: cty.String, Required: false},
"skip_metadata_api_check": &hcldec.AttrSpec{Name: "skip_metadata_api_check", Type: cty.Bool, Required: false},
"token": &hcldec.AttrSpec{Name: "token", Type: cty.String, Required: false},
"api": &hcldec.AttrSpec{Name: "api", Type: cty.String, Required: false},
"chroot_mounts": &hcldec.AttrSpec{Name: "chroot_mounts", Type: cty.List(cty.List(cty.String)), Required: false},
"command_wrapper": &hcldec.AttrSpec{Name: "command_wrapper", Type: cty.String, Required: false},
"copy_files": &hcldec.AttrSpec{Name: "copy_files", Type: cty.List(cty.String), Required: false},

View File

@ -25,7 +25,6 @@ type AccessConfig struct {
SkipMetadataApiCheck bool `mapstructure:"skip_metadata_api_check"`
Token string `mapstructure:"token"`
clientConfig *oapi.Config
API string `mapstructure:"api"`
getOAPIConnection func() oapi.OAPIClient
}
@ -141,13 +140,5 @@ func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {
fmt.Errorf("`access_key` and `secret_key` must both be either set or not set."))
}
if c.API != "" {
if c.API != "osc" && c.API != "oapi" {
c.API = "oapi"
}
} else {
c.API = "oapi"
}
return errs
}

View File

@ -61,13 +61,7 @@ func (s *StepPreValidate) Run(_ context.Context, state multistep.StateBag) multi
return multistep.ActionHalt
}
for _, omi := range resp.Images {
if omi.ImageName == imageName {
images = append(images, omi)
}
}
return images, nil
return multistep.ActionContinue
}
func (s *StepPreValidate) Cleanup(multistep.StateBag) {}