fix error cleaning up existing keyvault
This commit is contained in:
parent
b94937c05c
commit
e7dba3e55e
|
@ -228,11 +228,11 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
NewStepDeleteAdditionalDisks(azureClient, ui),
|
NewStepDeleteAdditionalDisks(azureClient, ui),
|
||||||
}
|
}
|
||||||
} else if b.config.OSType == constants.Target_Windows {
|
} else if b.config.OSType == constants.Target_Windows {
|
||||||
keyVaultDeploymentName := b.stateBag.Get(constants.ArmKeyVaultDeploymentName).(string)
|
|
||||||
steps = []multistep.Step{
|
steps = []multistep.Step{
|
||||||
NewStepCreateResourceGroup(azureClient, ui),
|
NewStepCreateResourceGroup(azureClient, ui),
|
||||||
}
|
}
|
||||||
if b.config.BuildKeyVaultName == "" {
|
if b.config.BuildKeyVaultName == "" {
|
||||||
|
keyVaultDeploymentName := b.stateBag.Get(constants.ArmKeyVaultDeploymentName).(string)
|
||||||
steps = append(steps,
|
steps = append(steps,
|
||||||
NewStepValidateTemplate(azureClient, ui, &b.config, GetKeyVaultDeployment),
|
NewStepValidateTemplate(azureClient, ui, &b.config, GetKeyVaultDeployment),
|
||||||
NewStepDeployTemplate(azureClient, ui, &b.config, keyVaultDeploymentName, GetKeyVaultDeployment),
|
NewStepDeployTemplate(azureClient, ui, &b.config, keyVaultDeploymentName, GetKeyVaultDeployment),
|
||||||
|
@ -399,7 +399,7 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) {
|
||||||
stateBag.Put(constants.ArmComputeName, b.config.tmpComputeName)
|
stateBag.Put(constants.ArmComputeName, b.config.tmpComputeName)
|
||||||
stateBag.Put(constants.ArmDeploymentName, b.config.tmpDeploymentName)
|
stateBag.Put(constants.ArmDeploymentName, b.config.tmpDeploymentName)
|
||||||
|
|
||||||
if b.config.OSType == constants.Target_Windows {
|
if b.config.OSType == constants.Target_Windows && b.config.BuildKeyVaultName == "" {
|
||||||
stateBag.Put(constants.ArmKeyVaultDeploymentName, fmt.Sprintf("kv%s", b.config.tmpDeploymentName))
|
stateBag.Put(constants.ArmKeyVaultDeploymentName, fmt.Sprintf("kv%s", b.config.tmpDeploymentName))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue