diff --git a/controller_test.go b/controller_test.go index 63a2754..7b515a3 100644 --- a/controller_test.go +++ b/controller_test.go @@ -699,7 +699,7 @@ func (s *controllerSuite) TestAddFileReader(c *gc.C) { var versionResponse = `{"version": "unknown", "subversion": "", "capabilities": ["networks-management", "static-ipaddresses", "ipv6-deployment-ubuntu", "devices-management", "storage-deployment-ubuntu", "network-deployment-ubuntu"]}` type cleanup interface { - AddCleanup(testing.CleanupFunc) + AddCleanup(func(*gc.C)) } // createTestServerController creates a controller backed on to a test server diff --git a/dependencies.tsv b/dependencies.tsv index 12fcacb..6312ca3 100644 --- a/dependencies.tsv +++ b/dependencies.tsv @@ -1,9 +1,9 @@ github.com/juju/errors git 1b5e39b83d1835fa480e0c2ddefb040ee82d58b3 2015-09-16T12:56:42Z github.com/juju/loggo git 8477fc936adf0e382d680310047ca27e128a309a 2015-05-27T03:58:39Z -github.com/juju/names git ef19de31613af3735aa69ba3b40accce2faf7316 2016-03-01T22:07:10Z +github.com/juju/names git 8a0aa0963bbacdc790914892e9ff942e94d6f795 2016-03-30T15:05:33Z github.com/juju/schema git 1e25943f8c6fd6815282d6f1ac87091d21e14e19 2016-03-01T11:16:46Z -github.com/juju/testing git 45f216f8ef2a6fbed3f38cbcd57f68741d295053 2016-03-17T08:39:30Z -github.com/juju/utils git af32cfaf28093965fdf63373d8447c489efb2875 2016-03-09T18:28:39Z +github.com/juju/testing git 162fafccebf20a4207ab93d63b986c230e3f4d2e 2016-04-04T09:43:17Z +github.com/juju/utils git eb6cb958762135bb61aed1e0951f657c674d427f 2016-04-11T02:40:59Z github.com/juju/version git ef897ad7f130870348ce306f61332f5335355063 2015-11-27T20:34:00Z golang.org/x/crypto git aedad9a179ec1ea11b7064c57cbc6dc30d7724ec 2015-08-30T18:06:42Z gopkg.in/check.v1 git 4f90aeace3a26ad7021961c297b22c42160c7b25 2016-01-05T16:49:36Z diff --git a/machine.go b/machine.go index 0019ca3..83eaea8 100644 --- a/machine.go +++ b/machine.go @@ -4,7 +4,6 @@ package gomaasapi import ( - "encoding/base64" "net/http" "github.com/juju/errors" @@ -174,7 +173,8 @@ func (m *machine) Devices(args DevicesArgs) ([]Device, error) { // StartArgs is an argument struct for passing parameters to the Machine.Start // method. type StartArgs struct { - UserData []byte + // UserData needs to be Base64 encoded user data for cloud-init. + UserData string DistroSeries string Kernel string Comment string @@ -182,12 +182,8 @@ type StartArgs struct { // Start implements Machine. func (m *machine) Start(args StartArgs) error { - var encodedUserData string - if args.UserData != nil { - encodedUserData = base64.StdEncoding.EncodeToString(args.UserData) - } params := NewURLParams() - params.MaybeAdd("user_data", encodedUserData) + params.MaybeAdd("user_data", args.UserData) params.MaybeAdd("distro_series", args.DistroSeries) params.MaybeAdd("hwe_kernel", args.Kernel) params.MaybeAdd("comment", args.Comment) diff --git a/machine_test.go b/machine_test.go index f973e84..c5e3821 100644 --- a/machine_test.go +++ b/machine_test.go @@ -4,7 +4,6 @@ package gomaasapi import ( - "encoding/base64" "net/http" "github.com/juju/errors" @@ -100,7 +99,7 @@ func (s *machineSuite) TestStart(c *gc.C) { server.AddPostResponse(machine.resourceURI+"?op=deploy", http.StatusOK, response) err := machine.Start(StartArgs{ - UserData: []byte("userdata"), + UserData: "userdata", DistroSeries: "trusty", Kernel: "kernel", Comment: "a comment", @@ -111,12 +110,12 @@ func (s *machineSuite) TestStart(c *gc.C) { request := server.LastRequest() // There should be one entry in the form values for each of the args. - c.Assert(request.PostForm, gc.HasLen, 4) - // The userdata should be base64 encoded. - userdata := request.PostForm.Get("user_data") - value, err := base64.StdEncoding.DecodeString(userdata) - c.Assert(err, jc.ErrorIsNil) - c.Assert(string(value), gc.Equals, "userdata") + form := request.PostForm + c.Assert(form, gc.HasLen, 4) + c.Check(form.Get("user_data"), gc.Equals, "userdata") + c.Check(form.Get("distro_series"), gc.Equals, "trusty") + c.Check(form.Get("hwe_kernel"), gc.Equals, "kernel") + c.Check(form.Get("comment"), gc.Equals, "a comment") } func (s *machineSuite) TestStartMachineNotFound(c *gc.C) {