Merge lp:~wallyworld/goose/RunServer-userData-fix into lp:~gophers/goose/trunk
Status: | Rejected |
---|---|
Rejected by: | Ian Booth |
Proposed branch: | lp:~wallyworld/goose/RunServer-userData-fix |
Merge into: | lp:~gophers/goose/trunk |
Diff against target: |
42 lines (+5/-7) 2 files modified
nova/live_test.go (+1/-2) nova/nova.go (+4/-5) |
To merge this branch: | bzr merge lp:~wallyworld/goose/RunServer-userData-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+145539@code.launchpad.net |
Description of the change
Fix RunServerOpts Userdata
The UserData attribute of RunServerOpts was []byte, but it needs to be string to make juju bootstrap work.
All the current nova tests simply ignore this attribute - they pass in nil. I tried writing a test to set up
a cloud init config with a simple script command and introduced a deliberate error but the nova create server
operation succeeded nonetheless. Yet the huge cloud init script used by juju bootstrap fails. So I'm not sure
how to set up a small, self contained test in goose for the userData attribute. The code in this merge proposal
makes juju happy though, apart from that fact that Canonistack sometimes gives a "Resource limit exeeded" error
when bootstrapping a juju instance.
Reviewers: mp+145539_ code.launchpad. net,
Message:
Please take a look.
Description:
Fix RunServerOpts Userdata
The UserData attribute of RunServerOpts was []byte, but it needs to be
string to make juju bootstrap work.
All the current nova tests simply ignore this attribute - they pass in
nil. I tried writing a test to set up
a cloud init config with a simple script command and introduced a
deliberate error but the nova create server
operation succeeded nonetheless. Yet the huge cloud init script used by
juju bootstrap fails. So I'm not sure
how to set up a small, self contained test in goose for the userData
attribute. The code in this merge proposal
makes juju happy though, apart from that fact that Canonistack sometimes
gives a "Resource limit exeeded" error
when bootstrapping a juju instance.
https:/ /code.launchpad .net/~wallyworl d/goose/ RunServer- userData- fix/+merge/ 145539
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/7221070/
Affected files:
A [revision details]
M nova/live_test.go
M nova/nova.go
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision: <email address hidden>
Index: nova/live_test.go RunServer( opts) RunServer( opts, nil)
=== modified file 'nova/live_test.go'
--- nova/live_test.go 2013-01-29 16:04:31 +0000
+++ nova/live_test.go 2013-01-30 04:40:58 +0000
@@ -67,9 +67,8 @@
Name: name,
FlavorId: testFlavourId,
ImageId: testImageId,
- UserData: nil,
}
- instance, err = s.nova.
+ instance, err = s.nova.
if err != nil {
return nil, err
}
Index: nova/nova.go pNames []SecurityGroupName `json:" security_ groups" ` //
=== modified file 'nova/nova.go'
--- nova/nova.go 2013-01-29 16:32:50 +0000
+++ nova/nova.go 2013-01-30 04:40:58 +0000
@@ -242,19 +242,18 @@
Name string `json:"name"` //
Required
FlavorId string `json:"flavorRef"` //
Required
ImageId string `json:"imageRef"` //
Required
- UserData []byte `json:"user_data"` //
Optional
+ UserData string `json:"user_data"` //
Optional
SecurityGrou
Optional
}
// RunServer creates a new server, based on the given RunServerOpts. StdEncoding. EncodeToString( opts.UserData) StdEncoding. EncodeToString( userData)
-func (c *Client) RunServer(opts RunServerOpts) (*Entity, error) {
+func (c *Client) RunServer(opts RunServerOpts, userData []byte) (*Entity,
error) {
var req struct {
Server RunServerOpts `json:"server"`
}
req.Server = opts
- if opts.UserData != nil {
- encoded := base64.
- req.Server.UserData = []byte(encoded)
+ if userData != nil {
+ req.Server.UserData = base64.
}
var resp struct {
Server Entity `json:"server"`