Skip to content

Commit

Permalink
fix: add more status to pending list when waiting an EVS volume (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiChangkuo authored Jan 13, 2024
1 parent 95099a4 commit 2621051
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion builder/ecs/async_server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ecs

import (
"fmt"
"log"
"net/http"

Expand Down Expand Up @@ -72,6 +73,13 @@ func volumeJobStateRefreshFunc(client *evs.EvsClient, jobID string) StateRefresh
}

status := response.Status.Value()
return response, status, nil
if status == "SUCCESS" {
return response, status, nil
}
if status == "FAIL" {
return response, status, fmt.Errorf("the EVS job (%s) status is FAIL: %s",
jobID, *response.FailReason)
}
return response, "PENDING", nil
}
}
2 changes: 1 addition & 1 deletion builder/ecs/step_attach_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func waitForAttachVolumeJobSuccess(ui packer.Ui, state multistep.StateBag, clien
func waitForCreateVolumeJobSuccess(ui packer.Ui, state multistep.StateBag, client *evs.EvsClient, jobID string) (*evsmodel.ShowJobResponse, error) {
ui.Message("Waiting for create volume success...")
stateChange := StateChangeConf{
Pending: []string{"INIT", "RUNNING"},
Pending: []string{"PENDING"},
Target: []string{"SUCCESS"},
Refresh: volumeJobStateRefreshFunc(client, jobID),
Timeout: 10 * time.Minute,
Expand Down

0 comments on commit 2621051

Please sign in to comment.