From e8e7f9b5bdcb57b016ac4c0bfd6ad47c55cfb261 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 24 Jul 2020 11:20:22 +0000 Subject: [PATCH] feat(baremetal): add boot type in start server --- ...usage-baremetal-server-create-usage.golden | 15 ++++++----- ...-usage-baremetal-server-start-usage.golden | 4 +++ .../namespaces/baremetal/v1/baremetal_cli.go | 26 +++++++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/cmd/scw/testdata/test-all-usage-baremetal-server-create-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-server-create-usage.golden index e2ae738a46..c1b724cbf3 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-server-create-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-server-create-usage.golden @@ -13,12 +13,15 @@ EXAMPLES: scw baremetal server create name=foo tags.0=prod tags.1=blue type=GP-BM1-M ARGS: - name= Name of the server (≠hostname) - [description] Description associated to the server, max 255 characters - [type=GP-BM1-S] Server commercial type (GP-BM1-L | GP-BM1-M | GP-BM1-S | HC-BM1-L | HC-BM1-S | HM-BM1-XL | HM-BM1-M) - [tags.{index}] Tags to associate to the server - [organization-id] Organization ID to use. If none is passed will use default organization ID from the config - [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) + name= Name of the server (≠hostname) + [description] Description associated to the server, max 255 characters + [type=GP-BM1-S] Server commercial type (GP-BM1-L | GP-BM1-M | GP-BM1-S | HC-BM1-L | HC-BM1-S | HM-BM1-XL | HM-BM1-M) + [tags.{index}] Tags to associate to the server + [install.os-id] + [install.hostname] + [install.ssh-key-ids.{index}] + [organization-id] Organization ID to use. If none is passed will use default organization ID from the config + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) FLAGS: -h, --help help for create diff --git a/cmd/scw/testdata/test-all-usage-baremetal-server-start-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-server-start-usage.golden index 5dc8b076d7..f64a5fde63 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-server-start-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-server-start-usage.golden @@ -9,8 +9,12 @@ EXAMPLES: Start a baremetal server scw baremetal server start 11111111-1111-1111-1111-111111111111 + Start a server in rescue mode + scw baremetal server start 11111111-1111-1111-1111-111111111111 + ARGS: server-id ID of the server to start + [boot-type] The type of boot (unknown_boot_type | normal | rescue) [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) FLAGS: diff --git a/internal/namespaces/baremetal/v1/baremetal_cli.go b/internal/namespaces/baremetal/v1/baremetal_cli.go index 2533a5dedc..f468c4e04b 100644 --- a/internal/namespaces/baremetal/v1/baremetal_cli.go +++ b/internal/namespaces/baremetal/v1/baremetal_cli.go @@ -191,6 +191,21 @@ func baremetalServerCreate() *core.Command { Required: false, Positional: false, }, + { + Name: "install.os-id", + Required: false, + Positional: false, + }, + { + Name: "install.hostname", + Required: false, + Positional: false, + }, + { + Name: "install.ssh-key-ids.{index}", + Required: false, + Positional: false, + }, core.OrganizationIDArgSpec(), core.ZoneArgSpec(scw.ZoneFrPar2), }, @@ -417,6 +432,13 @@ func baremetalServerStart() *core.Command { Required: true, Positional: true, }, + { + Name: "boot-type", + Short: `The type of boot`, + Required: false, + Positional: false, + EnumValues: []string{"unknown_boot_type", "normal", "rescue"}, + }, core.ZoneArgSpec(scw.ZoneFrPar2), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { @@ -432,6 +454,10 @@ func baremetalServerStart() *core.Command { Short: "Start a baremetal server", ArgsJSON: `{"server_id":"11111111-1111-1111-1111-111111111111"}`, }, + { + Short: "Start a server in rescue mode", + ArgsJSON: `{"boot_type":"rescue","server_id":"11111111-1111-1111-1111-111111111111"}`, + }, }, } }