From eda85a4daf8801c1e26c04997913f0fdd7032202 Mon Sep 17 00:00:00 2001 From: Julien BONACHERA Date: Fri, 29 Jun 2018 19:44:56 +0200 Subject: [PATCH 1/2] scaleway: add 'bootscript' configuration parameter --- builder/scaleway/config.go | 1 + builder/scaleway/step_create_server.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/builder/scaleway/config.go b/builder/scaleway/config.go index d658e1dad..84b5e989e 100644 --- a/builder/scaleway/config.go +++ b/builder/scaleway/config.go @@ -29,6 +29,7 @@ type Config struct { SnapshotName string `mapstructure:"snapshot_name"` ImageName string `mapstructure:"image_name"` ServerName string `mapstructure:"server_name"` + Bootscript string `mapstructure:"bootscript"` UserAgent string ctx interpolate.Context diff --git a/builder/scaleway/step_create_server.go b/builder/scaleway/step_create_server.go index 57511d149..63350548d 100644 --- a/builder/scaleway/step_create_server.go +++ b/builder/scaleway/step_create_server.go @@ -20,9 +20,14 @@ func (s *stepCreateServer) Run(_ context.Context, state multistep.StateBag) mult c := state.Get("config").(Config) sshPubKey := state.Get("ssh_pubkey").(string) tags := []string{} + var bootscript *string ui.Say("Creating server...") + if c.Bootscript != "" { + bootscript = &c.Bootscript + } + if sshPubKey != "" { tags = []string{fmt.Sprintf("AUTHORIZED_KEY=%s", strings.TrimSpace(sshPubKey))} } @@ -33,6 +38,7 @@ func (s *stepCreateServer) Run(_ context.Context, state multistep.StateBag) mult Organization: c.Organization, CommercialType: c.CommercialType, Tags: tags, + Bootscript: bootscript, }) if err != nil { From 3ea887a9a7952c23a90c918f4d94bd7ab220036a Mon Sep 17 00:00:00 2001 From: Julien BONACHERA Date: Fri, 29 Jun 2018 22:00:44 +0200 Subject: [PATCH 2/2] scaleway: mention new 'bootscript' parameter in documentation --- website/source/docs/builders/scaleway.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/source/docs/builders/scaleway.html.md b/website/source/docs/builders/scaleway.html.md index 1a525dbfa..bcef9f900 100644 --- a/website/source/docs/builders/scaleway.html.md +++ b/website/source/docs/builders/scaleway.html.md @@ -74,6 +74,9 @@ builder. - `snapshot_name` (string) - The name of the resulting snapshot that will appear in your account. Default `packer-TIMESTAMP` +- `bootscript` (string) - The id of an existing bootscript to use when booting + the server. + ## Basic Example Here is a basic example. It is completely valid as soon as you enter your own