Skip to content

Commit de8f66b

Browse files
committed
fix: Fixed the issue of using the wrong image when creating an instance based on an image family
1 parent dcc7e3b commit de8f66b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

builder/tencentcloud/cvm/step_check_source_image.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ func (s *stepCheckSourceImage) Run(ctx context.Context, state multistep.StateBag
2323
)
2424
config := state.Get("config").(*Config)
2525
client := state.Get("cvm_client").(*cvm.Client)
26+
source_image := state.Get("source_image").(*cvm.Image)
2627

2728
Say(state, config.SourceImageId, "Trying to check source image")
2829

2930
req := cvm.NewDescribeImagesRequest()
3031
req.InstanceType = &config.InstanceType
3132
if config.SourceImageId != "" {
3233
req.ImageIds = []*string{&config.SourceImageId}
34+
} else if *source_image.ImageId != "" {
35+
req.ImageIds = []*string{source_image.ImageId}
3336
} else {
3437
imageNameRegex, err = regexp.Compile(config.SourceImageName)
3538
if err != nil {

builder/tencentcloud/cvm/step_run_instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) mul
5555
return Halt(state, err, "Failed to get user_data")
5656
}
5757

58-
Say(state, "Trying to create a new instance", "")
58+
Say(state, *source_image.ImageId, "Try to create a new instance based on image")
5959

6060
// config RunInstances parameters
6161
req := cvm.NewRunInstancesRequest()

0 commit comments

Comments
 (0)