update err format

This commit is contained in:
유성덕 2018-01-12 10:12:47 +09:00
parent 4f9754a75c
commit 26030d750c
9 changed files with 12 additions and 12 deletions

View File

@ -42,7 +42,7 @@ func (s *StepCreateBlockStorageInstance) createBlockStorageInstance(serverInstan
blockStorageInstanceList, err := s.Conn.CreateBlockStorageInstance(reqParams) blockStorageInstanceList, err := s.Conn.CreateBlockStorageInstance(reqParams)
if err != nil { 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]) log.Println("Block Storage Instance information : ", blockStorageInstanceList.BlockStorageInstance[0])

View File

@ -38,7 +38,7 @@ func (s *StepCreateLoginKey) createLoginKey() (*LoginKey, error) {
privateKey, err := s.Conn.CreateLoginKey(KeyName) privateKey, err := s.Conn.CreateLoginKey(KeyName)
if err != nil { 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 return &LoginKey{KeyName, privateKey.PrivateKey}, nil

View File

@ -72,7 +72,7 @@ func (s *StepCreatePublicIPInstance) createPublicIPInstance(serverInstanceNo str
publicIPInstanceList, err := s.Conn.CreatePublicIPInstance(reqParams) publicIPInstanceList, err := s.Conn.CreatePublicIPInstance(reqParams)
if err != nil { if err != nil {
return nil, fmt.Errorf("error code: %d, error message: %s", publicIPInstanceList.ReturnCode, publicIPInstanceList.ReturnMessage) return nil, err
} }
publicIPInstance := publicIPInstanceList.PublicIPInstanceList[0] publicIPInstance := publicIPInstanceList.PublicIPInstanceList[0]
@ -143,7 +143,7 @@ func (s *StepCreatePublicIPInstance) waitPublicIPInstanceStatus(publicIPInstance
for { for {
resp, err := s.Conn.GetPublicIPInstanceList(reqParams) resp, err := s.Conn.GetPublicIPInstanceList(reqParams)
if err != nil { if err != nil {
log.Printf("error code: %d, error message: %s", resp.ReturnCode, resp.ReturnMessage) log.Printf(err.Error())
c1 <- err c1 <- err
return return
} }

View File

@ -65,7 +65,7 @@ func (s *StepDeleteBlockStorageInstance) deleteBlockStorageInstance(serverInstan
result, err := s.Conn.DeleteBlockStorageInstances(blockStorageInstanceList) result, err := s.Conn.DeleteBlockStorageInstances(blockStorageInstanceList)
if err != nil { 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)) s.Say(fmt.Sprintf("Block Storage Instance is deleted. Block Storage InstanceNo is %s", blockStorageInstanceList))

View File

@ -30,7 +30,7 @@ func NewStepDeleteLoginKey(conn *ncloud.Conn, ui packer.Ui) *StepDeleteLoginKey
func (s *StepDeleteLoginKey) deleteLoginKey(keyName string) error { func (s *StepDeleteLoginKey) deleteLoginKey(keyName string) error {
resp, err := s.Conn.DeleteLoginKey(keyName) resp, err := s.Conn.DeleteLoginKey(keyName)
if err != nil { if err != nil {
return fmt.Errorf("error code: %d , error message: %s", resp.ReturnCode, resp.ReturnMessage) return err
} }
return nil return nil

View File

@ -34,7 +34,7 @@ func (s *StepGetRootPassword) getRootPassword(serverInstanceNo string, privateKe
rootPassword, err := s.Conn.GetRootPassword(reqParams) rootPassword, err := s.Conn.GetRootPassword(reqParams)
if err != nil { if err != nil {
return "", fmt.Errorf("error code: %d, error message: %s", rootPassword.ReturnCode, rootPassword.ReturnMessage) return "", err
} }
return rootPassword.RootPassword, nil return rootPassword.RootPassword, nil

View File

@ -35,7 +35,7 @@ func (s *StepStopServerInstance) stopServerInstance(serverInstanceNo string) err
serverInstanceList, err := s.Conn.StopServerInstances(reqParams) serverInstanceList, err := s.Conn.StopServerInstances(reqParams)
if err != nil { 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)) s.Say(fmt.Sprintf("Server Instance is stopping. Server InstanceNo is %s", serverInstanceList.ServerInstanceList[0].ServerInstanceNo))

View File

@ -35,7 +35,7 @@ func (s *StepTerminateServerInstance) terminateServerInstance(serverInstanceNo s
serverInstanceList, err := s.Conn.TerminateServerInstances(reqParams) serverInstanceList, err := s.Conn.TerminateServerInstances(reqParams)
if err != nil { if err != nil {
return fmt.Errorf("error code: %d , error message: %s", serverInstanceList.ReturnCode, serverInstanceList.ReturnMessage) return err
} }
c1 := make(chan error, 1) c1 := make(chan error, 1)
@ -48,7 +48,7 @@ func (s *StepTerminateServerInstance) terminateServerInstance(serverInstanceNo s
serverInstanceList, err := s.Conn.GetServerInstanceList(reqParams) serverInstanceList, err := s.Conn.GetServerInstanceList(reqParams)
if err != nil { if err != nil {
c1 <- fmt.Errorf("error code: %d , error message: %s", serverInstanceList.ReturnCode, serverInstanceList.ReturnMessage) c1 <- err
return return
} else if serverInstanceList.TotalRows == 0 { } else if serverInstanceList.TotalRows == 0 {
c1 <- nil c1 <- nil

View File

@ -45,7 +45,7 @@ func (s *StepValidateTemplate) getZoneNo() error {
regionList, err := s.Conn.GetRegionList() regionList, err := s.Conn.GetRegionList()
if err != nil { if err != nil {
return fmt.Errorf("error code: %d , error message: %s", regionList.ReturnCode, regionList.ReturnMessage) return err
} }
var regionNo string var regionNo string
@ -64,7 +64,7 @@ func (s *StepValidateTemplate) getZoneNo() error {
// Get ZoneNo // Get ZoneNo
ZoneList, err := s.Conn.GetZoneList(regionNo) ZoneList, err := s.Conn.GetZoneList(regionNo)
if err != nil { if err != nil {
return fmt.Errorf("error code: %d , error message: %s", ZoneList.ReturnCode, ZoneList.ReturnMessage) return err
} }
if len(ZoneList.Zone) > 0 { if len(ZoneList.Zone) > 0 {