From d9e04438ed98b93797fb62d21bef64ef9892a609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=ADsli=20Freyr=20Brynjarsson?= Date: Tue, 8 May 2018 09:40:35 +0000 Subject: [PATCH] Fixes problems with userdata on rackspace When creating a server in the Rackspace public cloud the 'UserData' option does not do anything unless the 'ConfigDrive' option is set to 'true'. This commit fixes that problem by checking if the UserData option is non-empty and sets 'ConfigDrive' to 'true' if it is. --- rackspace/compute/v2/servers/requests.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rackspace/compute/v2/servers/requests.go b/rackspace/compute/v2/servers/requests.go index d4472a08..fe523906 100644 --- a/rackspace/compute/v2/servers/requests.go +++ b/rackspace/compute/v2/servers/requests.go @@ -76,6 +76,11 @@ type CreateOpts struct { // ToServerCreateMap constructs a request body using all of the OpenStack extensions that are // active on Rackspace. func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) { + + if len(opts.UserData) != 0 { + opts.ConfigDrive = true + } + base := os.CreateOpts{ Name: opts.Name, ImageRef: opts.ImageRef,