Skip to content

Commit 05e3bc9

Browse files
committed
Fixed create workflow
1 parent df98e9d commit 05e3bc9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

api/helpers.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,14 @@ func CreateServer(api *ScalewayAPI, imageName string, name string, bootscript st
244244
image := api.GetImageID(imageName, false)
245245
if image != "" {
246246
server.Image = &image
247+
} else {
248+
snapshotID := api.GetSnapshotID(imageName)
249+
snapshot, err := api.GetSnapshot(snapshotID)
250+
if err != nil {
251+
return "", err
252+
}
253+
server.Volumes["0"] = snapshot.BaseVolume.Identifier
247254
}
248-
snapshotID := api.GetSnapshotID(imageName)
249-
snapshot, err := api.GetSnapshot(snapshotID)
250-
if err != nil {
251-
return "", err
252-
}
253-
server.Volumes["0"] = snapshot.BaseVolume.Identifier
254255
}
255256

256257
serverID, err := api.PostServer(server)

0 commit comments

Comments
 (0)