diff --git a/builder/ncloud/step_create_block_storage_instance.go b/builder/ncloud/step_create_block_storage_instance.go index ef7306264..7e4d4b54a 100644 --- a/builder/ncloud/step_create_block_storage_instance.go +++ b/builder/ncloud/step_create_block_storage_instance.go @@ -42,7 +42,7 @@ func (s *StepCreateBlockStorageInstance) createBlockStorageInstance(serverInstan blockStorageInstanceList, err := s.Conn.CreateBlockStorageInstance(reqParams) if err != nil { - return "", fmt.Errorf("error code: %d, error message: %s", blockStorageInstanceList.ReturnCode, blockStorageInstanceList.ReturnMessage) + return "", err } log.Println("Block Storage Instance information : ", blockStorageInstanceList.BlockStorageInstance[0]) diff --git a/builder/ncloud/step_create_login_key.go b/builder/ncloud/step_create_login_key.go index 7dddebd25..d200c3106 100644 --- a/builder/ncloud/step_create_login_key.go +++ b/builder/ncloud/step_create_login_key.go @@ -38,7 +38,7 @@ func (s *StepCreateLoginKey) createLoginKey() (*LoginKey, error) { privateKey, err := s.Conn.CreateLoginKey(KeyName) if err != nil { - return nil, fmt.Errorf("error code: %d , error message: %s", privateKey.ReturnCode, privateKey.ReturnMessage) + return nil, err } return &LoginKey{KeyName, privateKey.PrivateKey}, nil diff --git a/builder/ncloud/step_create_public_ip_instance.go b/builder/ncloud/step_create_public_ip_instance.go index 88d98eb6c..1ea1517c5 100644 --- a/builder/ncloud/step_create_public_ip_instance.go +++ b/builder/ncloud/step_create_public_ip_instance.go @@ -72,7 +72,7 @@ func (s *StepCreatePublicIPInstance) createPublicIPInstance(serverInstanceNo str publicIPInstanceList, err := s.Conn.CreatePublicIPInstance(reqParams) if err != nil { - return nil, fmt.Errorf("error code: %d, error message: %s", publicIPInstanceList.ReturnCode, publicIPInstanceList.ReturnMessage) + return nil, err } publicIPInstance := publicIPInstanceList.PublicIPInstanceList[0] @@ -143,7 +143,7 @@ func (s *StepCreatePublicIPInstance) waitPublicIPInstanceStatus(publicIPInstance for { resp, err := s.Conn.GetPublicIPInstanceList(reqParams) if err != nil { - log.Printf("error code: %d, error message: %s", resp.ReturnCode, resp.ReturnMessage) + log.Printf(err.Error()) c1 <- err return } diff --git a/builder/ncloud/step_delete_block_storage_instance.go b/builder/ncloud/step_delete_block_storage_instance.go index 3c6c44b82..a077d4880 100644 --- a/builder/ncloud/step_delete_block_storage_instance.go +++ b/builder/ncloud/step_delete_block_storage_instance.go @@ -65,7 +65,7 @@ func (s *StepDeleteBlockStorageInstance) deleteBlockStorageInstance(serverInstan result, err := s.Conn.DeleteBlockStorageInstances(blockStorageInstanceList) if err != nil { - return fmt.Errorf("error code: %d , error message: %s", result.ReturnCode, result.ReturnMessage) + return err } s.Say(fmt.Sprintf("Block Storage Instance is deleted. Block Storage InstanceNo is %s", blockStorageInstanceList)) diff --git a/builder/ncloud/step_delete_login_key.go b/builder/ncloud/step_delete_login_key.go index b0cfbf7a1..c53dc3d1c 100644 --- a/builder/ncloud/step_delete_login_key.go +++ b/builder/ncloud/step_delete_login_key.go @@ -30,7 +30,7 @@ func NewStepDeleteLoginKey(conn *ncloud.Conn, ui packer.Ui) *StepDeleteLoginKey func (s *StepDeleteLoginKey) deleteLoginKey(keyName string) error { resp, err := s.Conn.DeleteLoginKey(keyName) if err != nil { - return fmt.Errorf("error code: %d , error message: %s", resp.ReturnCode, resp.ReturnMessage) + return err } return nil diff --git a/builder/ncloud/step_get_rootpassword.go b/builder/ncloud/step_get_rootpassword.go index c5070d179..3766d86df 100644 --- a/builder/ncloud/step_get_rootpassword.go +++ b/builder/ncloud/step_get_rootpassword.go @@ -34,7 +34,7 @@ func (s *StepGetRootPassword) getRootPassword(serverInstanceNo string, privateKe rootPassword, err := s.Conn.GetRootPassword(reqParams) if err != nil { - return "", fmt.Errorf("error code: %d, error message: %s", rootPassword.ReturnCode, rootPassword.ReturnMessage) + return "", err } return rootPassword.RootPassword, nil diff --git a/builder/ncloud/step_stop_server_instance.go b/builder/ncloud/step_stop_server_instance.go index 1c9252ed2..f9cce7d9f 100644 --- a/builder/ncloud/step_stop_server_instance.go +++ b/builder/ncloud/step_stop_server_instance.go @@ -35,7 +35,7 @@ func (s *StepStopServerInstance) stopServerInstance(serverInstanceNo string) err serverInstanceList, err := s.Conn.StopServerInstances(reqParams) if err != nil { - return fmt.Errorf("error code: %d , error message: %s", serverInstanceList.ReturnCode, serverInstanceList.ReturnMessage) + return err } s.Say(fmt.Sprintf("Server Instance is stopping. Server InstanceNo is %s", serverInstanceList.ServerInstanceList[0].ServerInstanceNo)) diff --git a/builder/ncloud/step_terminate_server_instance.go b/builder/ncloud/step_terminate_server_instance.go index 5d60236f0..208e6f1e6 100644 --- a/builder/ncloud/step_terminate_server_instance.go +++ b/builder/ncloud/step_terminate_server_instance.go @@ -35,7 +35,7 @@ func (s *StepTerminateServerInstance) terminateServerInstance(serverInstanceNo s serverInstanceList, err := s.Conn.TerminateServerInstances(reqParams) if err != nil { - return fmt.Errorf("error code: %d , error message: %s", serverInstanceList.ReturnCode, serverInstanceList.ReturnMessage) + return err } c1 := make(chan error, 1) @@ -48,7 +48,7 @@ func (s *StepTerminateServerInstance) terminateServerInstance(serverInstanceNo s serverInstanceList, err := s.Conn.GetServerInstanceList(reqParams) if err != nil { - c1 <- fmt.Errorf("error code: %d , error message: %s", serverInstanceList.ReturnCode, serverInstanceList.ReturnMessage) + c1 <- err return } else if serverInstanceList.TotalRows == 0 { c1 <- nil diff --git a/builder/ncloud/step_validate_template.go b/builder/ncloud/step_validate_template.go index 0007bfa40..d645111c4 100644 --- a/builder/ncloud/step_validate_template.go +++ b/builder/ncloud/step_validate_template.go @@ -45,7 +45,7 @@ func (s *StepValidateTemplate) getZoneNo() error { regionList, err := s.Conn.GetRegionList() if err != nil { - return fmt.Errorf("error code: %d , error message: %s", regionList.ReturnCode, regionList.ReturnMessage) + return err } var regionNo string @@ -64,7 +64,7 @@ func (s *StepValidateTemplate) getZoneNo() error { // Get ZoneNo ZoneList, err := s.Conn.GetZoneList(regionNo) if err != nil { - return fmt.Errorf("error code: %d , error message: %s", ZoneList.ReturnCode, ZoneList.ReturnMessage) + return err } if len(ZoneList.Zone) > 0 {