From b57140da4789b7b61ed6ad63f31920f1b5d3f2b8 Mon Sep 17 00:00:00 2001 From: Ian Duffy Date: Tue, 8 Dec 2015 12:45:26 +0000 Subject: [PATCH] Add support for using cloud-init via a ConfigDrive Signed-off-by: Ian Duffy --- builder/openstack/builder.go | 1 + builder/openstack/run_config.go | 2 ++ builder/openstack/step_run_source_server.go | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index 9f4c9e7bc..72610e73e 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -88,6 +88,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe AvailabilityZone: b.config.AvailabilityZone, UserData: b.config.UserData, UserDataFile: b.config.UserDataFile, + ConfigDrive: b.config.ConfigDrive, }, &StepWaitForRackConnect{ Wait: b.config.RackconnectWait, diff --git a/builder/openstack/run_config.go b/builder/openstack/run_config.go index a8b8638dc..536245323 100644 --- a/builder/openstack/run_config.go +++ b/builder/openstack/run_config.go @@ -25,6 +25,8 @@ type RunConfig struct { UserData string `mapstructure:"user_data"` UserDataFile string `mapstructure:"user_data_file"` + ConfigDrive bool `mapstructure:"config_drive"` + // Not really used, but here for BC OpenstackProvider string `mapstructure:"openstack_provider"` UseFloatingIp bool `mapstructure:"use_floating_ip"` diff --git a/builder/openstack/step_run_source_server.go b/builder/openstack/step_run_source_server.go index f78fe4f90..77e652dd5 100644 --- a/builder/openstack/step_run_source_server.go +++ b/builder/openstack/step_run_source_server.go @@ -19,8 +19,8 @@ type StepRunSourceServer struct { AvailabilityZone string UserData string UserDataFile string - - server *servers.Server + ConfigDrive bool + server *servers.Server } func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction { @@ -62,6 +62,7 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction Networks: networks, AvailabilityZone: s.AvailabilityZone, UserData: userData, + ConfigDrive: s.ConfigDrive, }, KeyName: keyName,