Skip to content

feat(instance): add boot-type to create server #1465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ARGS:
[placement-group-id] The placement group ID in witch the server has to be created
[bootscript-id] The bootscript ID to use, if empty the local boot will be used
[cloud-init] The cloud-init script to use
[boot-type=local] The boot type to use, if empty the local boot will be used. Will be overwritten to bootscript if bootscript-id is set. (local | bootscript | rescue)
[project-id] Project ID to use. If none is passed the default project ID will be used
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config

Expand Down
13 changes: 13 additions & 0 deletions internal/namespaces/instance/v1/custom_server_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type instanceCreateServerRequest struct {
PlacementGroupID string
BootscriptID string
CloudInit string
BootType string

// Deprecated, use project-id instead
OrganizationID *string
Expand Down Expand Up @@ -108,6 +109,12 @@ func serverCreateCommand() *core.Command {
Name: "cloud-init",
Short: "The cloud-init script to use",
},
{
Name: "boot-type",
Short: "The boot type to use, if empty the local boot will be used. Will be overwritten to bootscript if bootscript-id is set.",
Default: core.DefaultValueSetter(instance.BootTypeLocal.String()),
EnumValues: []string{instance.BootTypeLocal.String(), instance.BootTypeBootscript.String(), instance.BootTypeRescue.String()},
},
core.ProjectIDArgSpec(),
core.ZoneArgSpec(),
core.OrganizationIDDeprecatedArgSpec(),
Expand Down Expand Up @@ -286,6 +293,12 @@ func instanceServerCreateRun(ctx context.Context, argsI interface{}) (i interfac
serverReq.Volumes = sanitizeVolumeMap(serverReq.Name, volumes)
}

//
// BootType.
//
bootType := instance.BootType(args.BootType)
serverReq.BootType = &bootType

//
// Bootscript.
//
Expand Down