Skip to content

Commit

Permalink
fix(instance): boot_type mode on create server (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerome-quere authored Jul 15, 2020
1 parent 9272404 commit c7b5069
Show file tree
Hide file tree
Showing 4 changed files with 2,146 additions and 1,763 deletions.
8 changes: 7 additions & 1 deletion internal/namespaces/instance/v1/custom_server_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ func instanceServerCreateRun(ctx context.Context, argsI interface{}) (i interfac
}

serverReq.Bootscript = scw.StringPtr(args.BootscriptID)
bootType := instance.BootTypeBootscript
serverReq.BootType = &bootType
}

//
Expand All @@ -328,9 +330,13 @@ func instanceServerCreateRun(ctx context.Context, argsI interface{}) (i interfac
//
if needIPCreation {
logger.Debugf("creating IP")
organizationID := (*string)(nil)
if args.OrganizationID != "" {
organizationID = scw.StringPtr(args.OrganizationID)
}
res, err := apiInstance.CreateIP(&instance.CreateIPRequest{
Zone: args.Zone,
Organization: scw.StringPtr(args.OrganizationID),
Organization: organizationID,
})
if err != nil {
return nil, fmt.Errorf("error while creating your public IP: %s", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func Test_CreateServer(t *testing.T) {
Check: core.TestCheckCombine(
func(t *testing.T, ctx *core.CheckFuncCtx) {
assert.Equal(t, "eb760e3c-30d8-49a3-b3ad-ad10c3aa440b", ctx.Result.(*instance.Server).Bootscript.ID)
assert.Equal(t, instance.BootTypeBootscript, ctx.Result.(*instance.Server).BootType)
},
core.TestCheckExitCode(0),
),
Expand Down
Loading

0 comments on commit c7b5069

Please sign in to comment.