Skip to content

Commit 013b572

Browse files
committed
ecs: change the map value of SubJob.Entities to interface
the response of SubJob.Entities includes: server_id(string), nic_id(string) and attached_volume_ids([]string) so, we update the map value to interface.
1 parent 97be714 commit 013b572

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

openstack/ecs/v1/cloudservers/results_job.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type SubJob struct {
5959
FailReason string `json:"fail_reason"`
6060

6161
// Specifies the object of the task.
62-
Entities map[string]string `json:"entities"`
62+
Entities map[string]interface{} `json:"entities"`
6363
}
6464

6565
type JobResult struct {
@@ -91,7 +91,7 @@ func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string)
9191
return true, nil
9292
}
9393
if job.Status == "FAIL" {
94-
err = fmt.Errorf("Job failed with code %s: %s.\n", job.ErrorCode, job.FailReason)
94+
err = fmt.Errorf("Job failed with code %s: %s", job.ErrorCode, job.FailReason)
9595
return false, err
9696
}
9797

@@ -107,10 +107,10 @@ func GetJobEntity(client *golangsdk.ServiceClient, jobID string, label string) (
107107
}
108108

109109
if job.Status == "SUCCESS" {
110-
if e := job.Entities.SubJobs[0].Entities[label]; e != "" {
110+
if e, ok := job.Entities.SubJobs[0].Entities[label]; ok {
111111
return e, nil
112112
}
113113
}
114114

115-
return nil, fmt.Errorf("Unexpected conversion error in GetJobEntity.")
115+
return nil, fmt.Errorf("Unexpected conversion error in GetJobEntity")
116116
}

0 commit comments

Comments
 (0)