From 5e7e5a419dfb298f783e29c08b2fe40adfc84ab3 Mon Sep 17 00:00:00 2001 From: zhuzhih2017 Date: Fri, 26 May 2017 10:23:36 +0800 Subject: [PATCH] format the code as CI required --- builder/alicloud/ecs/step_attach_keypair.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/alicloud/ecs/step_attach_keypair.go b/builder/alicloud/ecs/step_attach_keypair.go index 4c96740b7..48e1f7069 100644 --- a/builder/alicloud/ecs/step_attach_keypair.go +++ b/builder/alicloud/ecs/step_attach_keypair.go @@ -21,13 +21,13 @@ func (s *stepAttachKeyPar) Run(state multistep.StateBag) multistep.StepAction { config := state.Get("config").(Config) instance := state.Get("instance").(*ecs.InstanceAttributesType) retry_times := 3 - for{ + for { err := client.AttachKeyPair(&ecs.AttachKeyPairArgs{RegionId: common.Region(config.AlicloudRegion), KeyPairName: keyPairName, InstanceIds: "[\"" + instance.InstanceId + "\"]"}) if err != nil { e, _ := err.(*common.Error) - if( (!(e.Code == "MissingParameter" || e.Code == "DependencyViolation.WindowsInstance" || e.Code == "InvalidKeyPairName.NotFound" || e.Code == "InvalidRegionId.NotFound"))&& retry_times>0){ - retry_times=retry_times-1 + if (!(e.Code == "MissingParameter" || e.Code == "DependencyViolation.WindowsInstance" || e.Code == "InvalidKeyPairName.NotFound" || e.Code == "InvalidRegionId.NotFound")) && retry_times > 0 { + retry_times = retry_times - 1 continue } err := fmt.Errorf("Error attaching keypair %s to instance %s : %s", keyPairName, instance.InstanceId, err)