diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go index 4ec2cf078..0ec5b0fdb 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go @@ -145,7 +145,7 @@ type CreateOpts struct { SecurityGroups []string `json:"-"` // UserData contains configuration information or scripts to use upon launch. - // Create will base64-encode it for you. + // Create will base64-encode it for you, if it isn't already. UserData []byte `json:"-"` // AvailabilityZone in which to launch the server. @@ -190,8 +190,13 @@ func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) { } if opts.UserData != nil { - encoded := base64.StdEncoding.EncodeToString(opts.UserData) - b["user_data"] = &encoded + var userData string + if _, err := base64.StdEncoding.DecodeString(string(opts.UserData)); err != nil { + userData = base64.StdEncoding.EncodeToString(opts.UserData) + } else { + userData = string(opts.UserData) + } + b["user_data"] = &userData } if len(opts.SecurityGroups) > 0 { diff --git a/vendor/vendor.json b/vendor/vendor.json index 92a068e20..588de03f3 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1060,10 +1060,10 @@ "revisionTime": "2016-10-25T18:03:21Z" }, { - "checksumSHA1": "8QsTL/u0QRMoQE9lJSE55/3YKvg=", + "checksumSHA1": "8rOLNDSqwz/DSKL1BoPqjtWSWAE=", "path": "github.com/gophercloud/gophercloud/openstack/compute/v2/servers", - "revision": "e3d6384a3714b335d075862e6eb0a681180643df", - "revisionTime": "2016-10-25T18:03:21Z" + "revision": "21a44e132331d6d46ab4187411c85ced6b1a9963", + "revisionTime": "2016-11-08T07:34:31Z" }, { "checksumSHA1": "1sVqsZBZBNhDXLY9XzjMkcOkcbg=",