Merge lp:~wallyworld/juju-core/gwacl-231 into lp:~go-bot/juju-core/trunk

Proposed by Ian Booth
Status: Superseded
Proposed branch: lp:~wallyworld/juju-core/gwacl-231
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 439 lines (+271/-3) (has conflicts)
13 files modified
cmd/juju/destroymachine.go (+1/-1)
cmd/juju/destroymachine_test.go (+4/-0)
cmd/juju/destroyservice.go (+1/-0)
cmd/juju/main_test.go (+2/-0)
cmd/jujud/bootstrap.go (+4/-0)
dependencies.tsv (+6/-1)
environs/httpstorage/storage.go (+4/-1)
provider/common/bootstrap_test.go (+4/-0)
provider/common/state.go (+90/-0)
provider/common/state_test.go (+141/-0)
scripts/win-installer/setup.iss (+4/-0)
state/apiserver/client/client_test.go (+6/-0)
version/version.go (+4/-0)
Text conflict in cmd/jujud/bootstrap.go
Text conflict in dependencies.tsv
Text conflict in provider/common/bootstrap_test.go
Text conflict in provider/common/state.go
Text conflict in provider/common/state_test.go
Text conflict in scripts/win-installer/setup.iss
Text conflict in state/apiserver/client/client_test.go
Text conflict in version/version.go
To merge this branch: bzr merge lp:~wallyworld/juju-core/gwacl-231
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+205697@code.launchpad.net

This proposal has been superseded by a proposal from 2014-02-11.

Description of the change

Update gwacl dependency to rev 231

We need this for a 1.16.6 release.

https://codereview.appspot.com/61800043/

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Reviewers: mp+205697_code.launchpad.net,

Message:
Please take a look.

Description:
Update gwacl dependency to rev 231

We need this for a 1.16.6 release.

https://code.launchpad.net/~wallyworld/juju-core/gwacl-231/+merge/205697

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/61800043/

Affected files (+106, -39 lines):
   A [revision details]
   M cmd/juju/destroymachine.go
   M cmd/juju/destroymachine_test.go
   M cmd/juju/destroyservice.go
   M cmd/juju/main_test.go
   M cmd/jujud/bootstrap.go
   M dependencies.tsv
   M environs/httpstorage/storage.go
   M provider/common/bootstrap_test.go
   M provider/common/state.go
   M provider/common/state_test.go
   M scripts/win-installer/setup.iss
   M state/apiserver/client/client_test.go
   M state/cleanup.go
   M state/cleanup_test.go
   M version/version.go

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/juju/destroymachine.go'
2--- cmd/juju/destroymachine.go 2014-01-07 12:36:45 +0000
3+++ cmd/juju/destroymachine.go 2014-02-11 06:08:00 +0000
4@@ -35,7 +35,7 @@
5 Args: "<machine> ...",
6 Purpose: "destroy machines",
7 Doc: destroyMachineDoc,
8- Aliases: []string{"terminate-machine"},
9+ Aliases: []string{"remove-machine", "terminate-machine"},
10 }
11 }
12
13
14=== modified file 'cmd/juju/destroymachine_test.go'
15--- cmd/juju/destroymachine_test.go 2014-01-24 14:26:05 +0000
16+++ cmd/juju/destroymachine_test.go 2014-02-11 06:08:00 +0000
17@@ -105,6 +105,10 @@
18 c.Assert(err, gc.IsNil)
19 err = u.Refresh()
20 c.Assert(err, jc.Satisfies, errors.IsNotFoundError)
21+ err = m0.Refresh()
22+ c.Assert(err, gc.IsNil)
23+ c.Assert(m0.Life(), gc.Equals, state.Dead)
24+
25 err = m1.Refresh()
26 c.Assert(err, gc.IsNil)
27 c.Assert(m1.Life(), gc.Equals, state.Dead)
28
29=== modified file 'cmd/juju/destroyservice.go'
30--- cmd/juju/destroyservice.go 2013-11-01 07:49:22 +0000
31+++ cmd/juju/destroyservice.go 2014-02-11 06:08:00 +0000
32@@ -23,6 +23,7 @@
33 Args: "<service>",
34 Purpose: "destroy a service",
35 Doc: "Destroying a service will destroy all its units and relations.",
36+ Aliases: []string{"remove-service"},
37 }
38 }
39
40
41=== modified file 'cmd/juju/main_test.go'
42--- cmd/juju/main_test.go 2014-01-22 23:36:28 +0000
43+++ cmd/juju/main_test.go 2014-02-11 06:08:00 +0000
44@@ -234,7 +234,9 @@
45 "help-tool",
46 "init",
47 "publish",
48+ "remove-machine", // alias for destroy-machine
49 "remove-relation", // alias for destroy-relation
50+ "remove-service", // alias for destroy-service
51 "remove-unit", // alias for destroy-unit
52 "resolved",
53 "run",
54
55=== modified file 'cmd/jujud/bootstrap.go'
56--- cmd/jujud/bootstrap.go 2014-02-05 08:01:22 +0000
57+++ cmd/jujud/bootstrap.go 2014-02-11 06:08:00 +0000
58@@ -62,7 +62,11 @@
59 return fmt.Errorf("cannot read provider-state-url file: %v", err)
60 }
61 stateInfoURL := strings.Split(string(data), "\n")[0]
62+<<<<<<< TREE
63 bsState, err := bootstrap.LoadStateFromURL(stateInfoURL)
64+=======
65+ bsState, err := common.LoadStateFromURL(stateInfoURL, !cfg.SSLHostnameVerification())
66+>>>>>>> MERGE-SOURCE
67 if err != nil {
68 return fmt.Errorf("cannot load state from URL %q (read from %q): %v", stateInfoURL, providerStateURLFile, err)
69 }
70
71=== modified file 'dependencies.tsv'
72--- dependencies.tsv 2014-02-05 05:01:01 +0000
73+++ dependencies.tsv 2014-02-11 06:08:00 +0000
74@@ -10,6 +10,11 @@
75 launchpad.net/gomaasapi bzr ian.booth@canonical.com-20131017011445-m1hmr0ap14osd7li 47
76 launchpad.net/goose bzr tarmac-20140124165235-h9rloooc531udms5 116
77 launchpad.net/goyaml bzr gustavo@niemeyer.net-20131114120802-abe042syx64z2m7s 50
78-launchpad.net/gwacl bzr tarmac-20140205045433-81h182mhz24fzp5e 231
79+<<<<<<< TREE
80+launchpad.net/gwacl bzr tarmac-20140205045433-81h182mhz24fzp5e 231
81+=======
82+launchpad.net/gwacl bzr tarmac-20140205045433-81h182mhz24fzp5e 231
83+launchpad.net/loggo bzr tim.penhey@canonical.com-20130729043644-ym0cscir1cist4sm 39
84+>>>>>>> MERGE-SOURCE
85 launchpad.net/lpad bzr gustavo@niemeyer.net-20120626194701-536yx0g9jdq2ik3h 64
86 launchpad.net/tomb bzr gustavo@niemeyer.net-20130531003818-70ikdgklbxopn8x4 17
87
88=== modified file 'environs/httpstorage/storage.go'
89--- environs/httpstorage/storage.go 2013-10-17 22:48:19 +0000
90+++ environs/httpstorage/storage.go 2014-02-11 06:08:00 +0000
91@@ -62,12 +62,15 @@
92 }
93
94 func (s *localStorage) getHTTPSBaseURL() (string, error) {
95- url, _ := s.URL("/") // never fails
96+ url, _ := s.URL("") // never fails
97 resp, err := s.client.Head(url)
98 if err != nil {
99 return "", err
100 }
101 resp.Body.Close()
102+ if resp.StatusCode != http.StatusOK {
103+ return "", fmt.Errorf("Could not access file storage: %v %s", url, resp.Status)
104+ }
105 httpsURL, err := resp.Location()
106 if err != nil {
107 return "", err
108
109=== modified file 'provider/common/bootstrap_test.go'
110--- provider/common/bootstrap_test.go 2014-01-30 17:27:26 +0000
111+++ provider/common/bootstrap_test.go 2014-02-11 06:08:00 +0000
112@@ -235,7 +235,11 @@
113 err := common.Bootstrap(ctx, env, constraints.Value{})
114 c.Assert(err, gc.IsNil)
115
116+<<<<<<< TREE
117 savedState, err := bootstrap.LoadStateFromURL(checkURL)
118+=======
119+ savedState, err := common.LoadStateFromURL(checkURL, false)
120+>>>>>>> MERGE-SOURCE
121 c.Assert(err, gc.IsNil)
122 c.Assert(savedState, gc.DeepEquals, &bootstrap.BootstrapState{
123 StateInstances: []instance.Id{instance.Id(checkInstanceId)},
124
125=== modified file 'provider/common/state.go'
126--- provider/common/state.go 2013-11-18 04:53:44 +0000
127+++ provider/common/state.go 2014-02-11 06:08:00 +0000
128@@ -14,8 +14,98 @@
129 "launchpad.net/juju-core/log"
130 "launchpad.net/juju-core/state"
131 "launchpad.net/juju-core/state/api"
132+ "launchpad.net/juju-core/utils"
133 )
134
135+<<<<<<< TREE
136+=======
137+// StateFile is the name of the file where the provider's state is stored.
138+const StateFile = "provider-state"
139+
140+// BootstrapState is the state information that is stored in StateFile.
141+//
142+// Individual providers may define their own state structures instead of
143+// this one, and use their own code for loading and saving those, but this is
144+// the definition that most practically useful providers share unchanged.
145+type BootstrapState struct {
146+ // StateInstances are the state servers.
147+ StateInstances []instance.Id `yaml:"state-instances"`
148+ // Characteristics reflect the hardware each state server is running on.
149+ // This is used at bootstrap time so the state server knows what hardware it has.
150+ // The state *may* be updated later without this information, but by then it's
151+ // served it's purpose.
152+ Characteristics []instance.HardwareCharacteristics `yaml:"characteristics,omitempty"`
153+}
154+
155+// putState writes the given data to the state file on the given storage.
156+// The file's name is as defined in StateFile.
157+func putState(storage storage.StorageWriter, data []byte) error {
158+ return storage.Put(StateFile, bytes.NewBuffer(data), int64(len(data)))
159+}
160+
161+// CreateStateFile creates an empty state file on the given storage, and
162+// returns its URL.
163+func CreateStateFile(storage storage.Storage) (string, error) {
164+ err := putState(storage, []byte{})
165+ if err != nil {
166+ return "", fmt.Errorf("cannot create initial state file: %v", err)
167+ }
168+ return storage.URL(StateFile)
169+}
170+
171+// SaveState writes the given state to the given storage.
172+func SaveState(storage storage.StorageWriter, state *BootstrapState) error {
173+ data, err := goyaml.Marshal(state)
174+ if err != nil {
175+ return err
176+ }
177+ return putState(storage, data)
178+}
179+
180+// LoadStateFromURL reads state from the given URL.
181+func LoadStateFromURL(url string, disableSSLHostnameVerification bool) (*BootstrapState, error) {
182+ client := http.DefaultClient
183+ if disableSSLHostnameVerification {
184+ logger.Infof("hostname SSL verification disabled")
185+ client = utils.GetNonValidatingHTTPClient()
186+ }
187+ resp, err := client.Get(url)
188+ if err != nil {
189+ return nil, err
190+ }
191+ if resp.StatusCode != http.StatusOK {
192+ return nil, fmt.Errorf("could not load state from url: %v %s", url, resp.Status)
193+ }
194+ return loadState(resp.Body)
195+}
196+
197+// LoadState reads state from the given storage.
198+func LoadState(stor storage.StorageReader) (*BootstrapState, error) {
199+ r, err := storage.Get(stor, StateFile)
200+ if err != nil {
201+ if coreerrors.IsNotFoundError(err) {
202+ return nil, environs.ErrNotBootstrapped
203+ }
204+ return nil, err
205+ }
206+ return loadState(r)
207+}
208+
209+func loadState(r io.ReadCloser) (*BootstrapState, error) {
210+ defer r.Close()
211+ data, err := ioutil.ReadAll(r)
212+ if err != nil {
213+ return nil, fmt.Errorf("error reading %q: %v", StateFile, err)
214+ }
215+ var state BootstrapState
216+ err = goyaml.Unmarshal(data, &state)
217+ if err != nil {
218+ return nil, fmt.Errorf("error unmarshalling %q: %v", StateFile, err)
219+ }
220+ return &state, nil
221+}
222+
223+>>>>>>> MERGE-SOURCE
224 // getDNSNames queries and returns the DNS names for the given instances,
225 // ignoring nil instances or ones without DNS names.
226 func getDNSNames(instances []instance.Instance) []string {
227
228=== modified file 'provider/common/state_test.go'
229--- provider/common/state_test.go 2013-11-18 04:53:44 +0000
230+++ provider/common/state_test.go 2014-02-11 06:08:00 +0000
231@@ -4,6 +4,14 @@
232 package common_test
233
234 import (
235+<<<<<<< TREE
236+=======
237+ "io/ioutil"
238+ "net/http"
239+ "net/http/httptest"
240+ "path/filepath"
241+
242+>>>>>>> MERGE-SOURCE
243 gc "launchpad.net/gocheck"
244
245 "launchpad.net/juju-core/environs/config"
246@@ -19,6 +27,139 @@
247
248 var _ = gc.Suite(&StateSuite{})
249
250+<<<<<<< TREE
251+=======
252+type cleaner interface {
253+ AddCleanup(testbase.CleanupFunc)
254+}
255+
256+func newStorageWithDataDir(suite cleaner, c *gc.C) (stor storage.Storage, dataDir string) {
257+ closer, stor, dataDir := envtesting.CreateLocalTestStorage(c)
258+ suite.AddCleanup(func(*gc.C) { closer.Close() })
259+ return
260+}
261+
262+func newStorage(suite cleaner, c *gc.C) (stor storage.Storage) {
263+ stor, _ = newStorageWithDataDir(suite, c)
264+ return
265+}
266+
267+// testingHTTPServer creates a tempdir backed https server with internal
268+// self-signed certs that will not be accepted as valid.
269+func testingHTTPSServer(suite cleaner, c *gc.C) (baseURL string, dataDir string) {
270+ dataDir = c.MkDir()
271+ mux := http.NewServeMux()
272+ mux.Handle("/", http.FileServer(http.Dir(dataDir)))
273+ server := httptest.NewTLSServer(mux)
274+ suite.AddCleanup(func(*gc.C) { server.Close() })
275+ baseURL = server.URL
276+ return
277+}
278+
279+func (suite *StateSuite) TestCreateStateFileWritesEmptyStateFile(c *gc.C) {
280+ stor := newStorage(suite, c)
281+
282+ url, err := common.CreateStateFile(stor)
283+ c.Assert(err, gc.IsNil)
284+
285+ reader, err := storage.Get(stor, common.StateFile)
286+ c.Assert(err, gc.IsNil)
287+ data, err := ioutil.ReadAll(reader)
288+ c.Assert(err, gc.IsNil)
289+ c.Check(string(data), gc.Equals, "")
290+ c.Assert(url, gc.NotNil)
291+ expectedURL, err := stor.URL(common.StateFile)
292+ c.Assert(err, gc.IsNil)
293+ c.Check(url, gc.Equals, expectedURL)
294+}
295+
296+func (suite *StateSuite) TestSaveStateWritesStateFile(c *gc.C) {
297+ stor := newStorage(suite, c)
298+ arch := "amd64"
299+ state := common.BootstrapState{
300+ StateInstances: []instance.Id{instance.Id("an-instance-id")},
301+ Characteristics: []instance.HardwareCharacteristics{{Arch: &arch}}}
302+ marshaledState, err := goyaml.Marshal(state)
303+ c.Assert(err, gc.IsNil)
304+
305+ err = common.SaveState(stor, &state)
306+ c.Assert(err, gc.IsNil)
307+
308+ loadedState, err := storage.Get(stor, common.StateFile)
309+ c.Assert(err, gc.IsNil)
310+ content, err := ioutil.ReadAll(loadedState)
311+ c.Assert(err, gc.IsNil)
312+ c.Check(content, gc.DeepEquals, marshaledState)
313+}
314+
315+func (suite *StateSuite) setUpSavedState(c *gc.C, dataDir string) common.BootstrapState {
316+ arch := "amd64"
317+ state := common.BootstrapState{
318+ StateInstances: []instance.Id{instance.Id("an-instance-id")},
319+ Characteristics: []instance.HardwareCharacteristics{{Arch: &arch}}}
320+ content, err := goyaml.Marshal(state)
321+ c.Assert(err, gc.IsNil)
322+ err = ioutil.WriteFile(filepath.Join(dataDir, common.StateFile), []byte(content), 0644)
323+ c.Assert(err, gc.IsNil)
324+ return state
325+}
326+
327+func (suite *StateSuite) TestLoadStateReadsStateFile(c *gc.C) {
328+ storage, dataDir := newStorageWithDataDir(suite, c)
329+ state := suite.setUpSavedState(c, dataDir)
330+ storedState, err := common.LoadState(storage)
331+ c.Assert(err, gc.IsNil)
332+ c.Check(*storedState, gc.DeepEquals, state)
333+}
334+
335+func (suite *StateSuite) TestLoadStateFromURLReadsStateFile(c *gc.C) {
336+ stor, dataDir := newStorageWithDataDir(suite, c)
337+ state := suite.setUpSavedState(c, dataDir)
338+ url, err := stor.URL(common.StateFile)
339+ c.Assert(err, gc.IsNil)
340+ storedState, err := common.LoadStateFromURL(url, false)
341+ c.Assert(err, gc.IsNil)
342+ c.Check(*storedState, gc.DeepEquals, state)
343+}
344+
345+func (suite *StateSuite) TestLoadStateFromURLBadCert(c *gc.C) {
346+ baseURL, _ := testingHTTPSServer(suite, c)
347+ url := baseURL + "/" + common.StateFile
348+ storedState, err := common.LoadStateFromURL(url, false)
349+ c.Assert(err, gc.ErrorMatches, ".*/provider-state:.* certificate signed by unknown authority")
350+ c.Assert(storedState, gc.IsNil)
351+}
352+
353+func (suite *StateSuite) TestLoadStateFromURLBadCertPermitted(c *gc.C) {
354+ baseURL, dataDir := testingHTTPSServer(suite, c)
355+ state := suite.setUpSavedState(c, dataDir)
356+ url := baseURL + "/" + common.StateFile
357+ storedState, err := common.LoadStateFromURL(url, true)
358+ c.Assert(err, gc.IsNil)
359+ c.Check(*storedState, gc.DeepEquals, state)
360+}
361+
362+func (suite *StateSuite) TestLoadStateMissingFile(c *gc.C) {
363+ stor := newStorage(suite, c)
364+ _, err := common.LoadState(stor)
365+ c.Check(err, gc.Equals, environs.ErrNotBootstrapped)
366+}
367+
368+func (suite *StateSuite) TestLoadStateIntegratesWithSaveState(c *gc.C) {
369+ storage := newStorage(suite, c)
370+ arch := "amd64"
371+ state := common.BootstrapState{
372+ StateInstances: []instance.Id{instance.Id("an-instance-id")},
373+ Characteristics: []instance.HardwareCharacteristics{{Arch: &arch}}}
374+ err := common.SaveState(storage, &state)
375+ c.Assert(err, gc.IsNil)
376+ storedState, err := common.LoadState(storage)
377+ c.Assert(err, gc.IsNil)
378+
379+ c.Check(*storedState, gc.DeepEquals, state)
380+}
381+
382+>>>>>>> MERGE-SOURCE
383 func (suite *StateSuite) TestGetDNSNamesAcceptsNil(c *gc.C) {
384 result := common.GetDNSNames(nil)
385 c.Check(result, gc.DeepEquals, []string{})
386
387=== modified file 'scripts/win-installer/setup.iss'
388--- scripts/win-installer/setup.iss 2014-01-31 15:41:48 +0000
389+++ scripts/win-installer/setup.iss 2014-02-11 06:08:00 +0000
390@@ -2,7 +2,11 @@
391 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
392
393 #define MyAppName "Juju"
394+<<<<<<< TREE
395 #define MyAppVersion "1.17.3"
396+=======
397+#define MyAppVersion "1.16.6"
398+>>>>>>> MERGE-SOURCE
399 #define MyAppPublisher "Canonical, Ltd"
400 #define MyAppURL "http://juju.ubuntu.com/"
401 #define MyAppExeName "juju.exe"
402
403=== modified file 'state/apiserver/client/client_test.go'
404--- state/apiserver/client/client_test.go 2014-01-30 14:11:27 +0000
405+++ state/apiserver/client/client_test.go 2014-02-11 06:08:00 +0000
406@@ -554,9 +554,15 @@
407
408 err = s.State.Cleanup()
409 c.Assert(err, gc.IsNil)
410+<<<<<<< TREE
411 assertLife(c, m0, state.Alive)
412 assertLife(c, m1, state.Dead)
413 assertLife(c, m2, state.Dead)
414+=======
415+ assertLife(c, m0, state.Dead)
416+ assertLife(c, m1, state.Alive)
417+ assertLife(c, m2, state.Dead)
418+>>>>>>> MERGE-SOURCE
419 assertRemoved(c, u)
420 }
421
422
423=== modified file 'state/cleanup.go'
424=== modified file 'state/cleanup_test.go'
425=== modified file 'version/version.go'
426--- version/version.go 2014-01-31 15:41:48 +0000
427+++ version/version.go 2014-02-11 06:08:00 +0000
428@@ -22,7 +22,11 @@
429 // The presence and format of this constant is very important.
430 // The debian/rules build recipe uses this value for the version
431 // number of the release package.
432+<<<<<<< TREE
433 const version = "1.17.3"
434+=======
435+const version = "1.16.6"
436+>>>>>>> MERGE-SOURCE
437
438 // Current gives the current version of the system. If the file
439 // "FORCE-VERSION" is present in the same directory as the running

Subscribers

People subscribed via source and target branches

to status/vote changes: