Skip to content

Commit c7b5069

Browse files
authored
fix(instance): boot_type mode on create server (#1225)
1 parent 9272404 commit c7b5069

File tree

4 files changed

+2146
-1763
lines changed

4 files changed

+2146
-1763
lines changed

internal/namespaces/instance/v1/custom_server_create.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ func instanceServerCreateRun(ctx context.Context, argsI interface{}) (i interfac
303303
}
304304

305305
serverReq.Bootscript = scw.StringPtr(args.BootscriptID)
306+
bootType := instance.BootTypeBootscript
307+
serverReq.BootType = &bootType
306308
}
307309

308310
//
@@ -328,9 +330,13 @@ func instanceServerCreateRun(ctx context.Context, argsI interface{}) (i interfac
328330
//
329331
if needIPCreation {
330332
logger.Debugf("creating IP")
333+
organizationID := (*string)(nil)
334+
if args.OrganizationID != "" {
335+
organizationID = scw.StringPtr(args.OrganizationID)
336+
}
331337
res, err := apiInstance.CreateIP(&instance.CreateIPRequest{
332338
Zone: args.Zone,
333-
Organization: scw.StringPtr(args.OrganizationID),
339+
Organization: organizationID,
334340
})
335341
if err != nil {
336342
return nil, fmt.Errorf("error while creating your public IP: %s", err)

internal/namespaces/instance/v1/custom_server_create_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func Test_CreateServer(t *testing.T) {
7575
Check: core.TestCheckCombine(
7676
func(t *testing.T, ctx *core.CheckFuncCtx) {
7777
assert.Equal(t, "eb760e3c-30d8-49a3-b3ad-ad10c3aa440b", ctx.Result.(*instance.Server).Bootscript.ID)
78+
assert.Equal(t, instance.BootTypeBootscript, ctx.Result.(*instance.Server).BootType)
7879
},
7980
core.TestCheckExitCode(0),
8081
),

0 commit comments

Comments
 (0)