Merge lp:~wallyworld/juju-core/fix-tools-sources into lp:~go-bot/juju-core/trunk

Proposed by Ian Booth
Status: Merged
Approved by: Ian Booth
Approved revision: no longer in the source branch.
Merged at revision: 1896
Proposed branch: lp:~wallyworld/juju-core/fix-tools-sources
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 126 lines (+42/-2)
4 files modified
provider/azure/environ.go (+5/-1)
provider/azure/environ_test.go (+4/-1)
provider/local/environ.go (+12/-0)
provider/local/environ_test.go (+21/-0)
To merge this branch: bzr merge lp:~wallyworld/juju-core/fix-tools-sources
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+187959@code.launchpad.net

Commit message

Fix tools sources for local and azure

The local provider did not implement CustomToolsSources,
so when it tried to get tools via simplestreams, it
failed and then used the legacy fallback. But this meant
that checksum and size info was missing.

The azure provider did implement CustomToolsSources, but
until the official tools repository comes online, the
tools sources do need to include the public container
from which tools can be fetched, or else simplestreams
will fail and revert to legacy tools code.

https://codereview.appspot.com/14011043/

Description of the change

Fix tools sources for local and azure

The local provider did not implement CustomToolsSources,
so when it tried to get tools via simplestreams, it
failed and then used the legacy fallback. But this meant
that checksum and size info was missing.

The azure provider did implement CustomToolsSources, but
until the official tools repository comes online, the
tools sources do need to include the public container
from which tools can be fetched, or else simplestreams
will fail and revert to legacy tools code.

https://codereview.appspot.com/14011043/

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

Reviewers: mp+187959_code.launchpad.net,

Message:
Please take a look.

Description:
Fix tools sources for local and azure

The local provider did not implement CustomToolsSources,
so when it tried to get tools via simplestreams, it
failed and then used the legacy fallback. But this meant
that checksum and size info was missing.

The azure provider did implement CustomToolsSources, but
until the official tools repository comes online, the
tools sources do need to include the public container
from which tools can be fetched, or else simplestreams
will fail and revert to legacy tools code.

https://code.launchpad.net/~wallyworld/juju-core/fix-tools-sources/+merge/187959

(do not edit description out of merge proposal)

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

Affected files (+46, -2 lines):
   A [revision details]
   M provider/azure/environ.go
   M provider/azure/environ_test.go
   M provider/local/environ.go
   M provider/local/local_test.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: tarmac-20130926184157-5d305cr4rb895lnt
+New revision: <email address hidden>

Index: provider/azure/environ.go
=== modified file 'provider/azure/environ.go'
--- provider/azure/environ.go 2013-09-26 09:18:36 +0000
+++ provider/azure/environ.go 2013-09-27 00:23:48 +0000
@@ -918,7 +918,11 @@
  // GetToolsSources returns a list of sources which are used to search for
simplestreams tools metadata.
  func (env *azureEnviron) GetToolsSources() ([]simplestreams.DataSource,
error) {
   // Add the simplestreams source off the control bucket.
- return
[]simplestreams.DataSource{storage.NewStorageSimpleStreamsDataSource(env.Storage(),
storage.BaseToolsPath)}, nil
+ sources := []simplestreams.DataSource{
+ storage.NewStorageSimpleStreamsDataSource(env.Storage(),
storage.BaseToolsPath),
+ simplestreams.NewURLDataSource(
+ "https://jujutools.blob.core.windows.net/juju-tools/tools",
simplestreams.VerifySSLHostnames)}
+ return sources, nil
  }

  // getImageStream returns the name of the simplestreams stream from which

Index: provider/azure/environ_test.go
=== modified file 'provider/azure/environ_test.go'
--- provider/azure/environ_test.go 2013-09-26 12:28:28 +0000
+++ provider/azure/environ_test.go 2013-09-27 00:23:48 +0000
@@ -1313,6 +1313,9 @@

   sources, err := tools.GetMetadataSources(env)
   c.Assert(err, gc.IsNil)
- c.Assert(len(sources), gc.Equals, 1)
+ c.Assert(len(sources), gc.Equals, 2)
   assertSourceContents(c, sources[0], "filename", data)
+ url, err := sources[1].URL("")
+ c.Assert(err, gc.IsNil)
+ c.Assert(url,
gc.Equals, "https://jujutools.blob.core.windows.net/juju-tools/tools/")
  }

Index: provider/local/environ.go
=== modified file 'provider/local/environ.go'
--- provider/local/environ.go 2013-09-26 09:18:36 +0000
+++ provider/local/environ.go 2013-09-27 00:23:48 +0000
@@ -23,7 +23,9 @@
   "launchpad.net/juju-core/environs/config"
   "launchpad.net/juju-core/environs/filestorage"
   "launchpad.net/juju-core/environs/httpstorage"
+ "l...

Read more...

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (7.2 KiB)

The attempt to merge lp:~wallyworld/juju-core/fix-tools-sources into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core/agent 0.728s
ok launchpad.net/juju-core/agent/tools 0.237s
ok launchpad.net/juju-core/bzr 6.740s
ok launchpad.net/juju-core/cert 2.957s
ok launchpad.net/juju-core/charm 0.582s
? launchpad.net/juju-core/charm/hooks [no test files]
ok launchpad.net/juju-core/cloudinit 0.027s
ok launchpad.net/juju-core/cmd 0.268s
? launchpad.net/juju-core/cmd/builddb [no test files]
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 157.764s
ok launchpad.net/juju-core/cmd/jujud 39.006s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 1.754s
ok launchpad.net/juju-core/constraints 0.024s
ok launchpad.net/juju-core/container/lxc 0.279s
? launchpad.net/juju-core/container/lxc/mock [no test files]
ok launchpad.net/juju-core/downloader 5.289s
ok launchpad.net/juju-core/environs 2.044s
ok launchpad.net/juju-core/environs/bootstrap 5.283s
ok launchpad.net/juju-core/environs/cloudinit 0.454s
ok launchpad.net/juju-core/environs/config 0.769s
ok launchpad.net/juju-core/environs/configstore 0.032s
ok launchpad.net/juju-core/environs/filestorage 0.044s
ok launchpad.net/juju-core/environs/httpstorage 0.731s
ok launchpad.net/juju-core/environs/imagemetadata 0.473s
ok launchpad.net/juju-core/environs/instances 0.050s
ok launchpad.net/juju-core/environs/jujutest 0.234s
ok launchpad.net/juju-core/environs/manual 4.751s
ok launchpad.net/juju-core/environs/simplestreams 0.307s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.628s
ok launchpad.net/juju-core/environs/storage 0.269s
ok launchpad.net/juju-core/environs/sync 26.416s
ok launchpad.net/juju-core/environs/testing 0.188s
ok launchpad.net/juju-core/environs/tools 11.565s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.015s
ok launchpad.net/juju-core/instance 0.021s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 23.160s
ok launchpad.net/juju-core/juju/osenv 0.018s
? launchpad.net/juju-core/juju/testing [no test files]
ok launchpad.net/juju-core/log 0.018s
ok launchpad.net/juju-core/log/syslog 0.021s
ok launchpad.net/juju-core/names 0.033s
ok launchpad.net/juju-core/provider 0.607s
? launchpad.net/juju-core/provider/all [no test files]
ok launchpad.net/juju-core/provider/azure 6.379s
ok launchpad.net/juju-core/provider/dummy 21.021s
ok launchpad.net/juju-core/provider/ec2 4.930s
ok launchpad.net/juju-core/provider/ec2/httpstorage 0.205s

----------------------------------------------------------------------
FAIL: local_test.go:43: localSuite.TestGetToolsMetadataSources

[LOG] 53.60978 INFO juju.provider.local opening environment "test"
[LOG] 53.66574 ERROR juju.utils cannot find network interface "lxcbr0": net: no such interface
[LOG] 53.66576 ERROR juju.provider.local failure setting config: ne...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'provider/azure/environ.go'
2--- provider/azure/environ.go 2013-09-26 09:18:36 +0000
3+++ provider/azure/environ.go 2013-09-27 00:52:44 +0000
4@@ -918,7 +918,11 @@
5 // GetToolsSources returns a list of sources which are used to search for simplestreams tools metadata.
6 func (env *azureEnviron) GetToolsSources() ([]simplestreams.DataSource, error) {
7 // Add the simplestreams source off the control bucket.
8- return []simplestreams.DataSource{storage.NewStorageSimpleStreamsDataSource(env.Storage(), storage.BaseToolsPath)}, nil
9+ sources := []simplestreams.DataSource{
10+ storage.NewStorageSimpleStreamsDataSource(env.Storage(), storage.BaseToolsPath),
11+ simplestreams.NewURLDataSource(
12+ "https://jujutools.blob.core.windows.net/juju-tools/tools", simplestreams.VerifySSLHostnames)}
13+ return sources, nil
14 }
15
16 // getImageStream returns the name of the simplestreams stream from which
17
18=== modified file 'provider/azure/environ_test.go'
19--- provider/azure/environ_test.go 2013-09-26 12:28:28 +0000
20+++ provider/azure/environ_test.go 2013-09-27 00:52:44 +0000
21@@ -1313,6 +1313,9 @@
22
23 sources, err := tools.GetMetadataSources(env)
24 c.Assert(err, gc.IsNil)
25- c.Assert(len(sources), gc.Equals, 1)
26+ c.Assert(len(sources), gc.Equals, 2)
27 assertSourceContents(c, sources[0], "filename", data)
28+ url, err := sources[1].URL("")
29+ c.Assert(err, gc.IsNil)
30+ c.Assert(url, gc.Equals, "https://jujutools.blob.core.windows.net/juju-tools/tools/")
31 }
32
33=== modified file 'provider/local/environ.go'
34--- provider/local/environ.go 2013-09-26 09:18:36 +0000
35+++ provider/local/environ.go 2013-09-27 00:52:44 +0000
36@@ -23,7 +23,9 @@
37 "launchpad.net/juju-core/environs/config"
38 "launchpad.net/juju-core/environs/filestorage"
39 "launchpad.net/juju-core/environs/httpstorage"
40+ "launchpad.net/juju-core/environs/simplestreams"
41 "launchpad.net/juju-core/environs/storage"
42+ envtools "launchpad.net/juju-core/environs/tools"
43 coreerrors "launchpad.net/juju-core/errors"
44 "launchpad.net/juju-core/instance"
45 "launchpad.net/juju-core/juju/osenv"
46@@ -54,6 +56,9 @@
47 // localEnviron implements Environ.
48 var _ environs.Environ = (*localEnviron)(nil)
49
50+// localEnviron implements SupportsCustomSources.
51+var _ envtools.SupportsCustomSources = (*localEnviron)(nil)
52+
53 type localEnviron struct {
54 localMutex sync.Mutex
55 config *environConfig
56@@ -63,6 +68,13 @@
57 containerManager lxc.ContainerManager
58 }
59
60+// GetToolsSources returns a list of sources which are used to search for simplestreams tools metadata.
61+func (e *localEnviron) GetToolsSources() ([]simplestreams.DataSource, error) {
62+ // Add the simplestreams source off the control bucket.
63+ return []simplestreams.DataSource{
64+ storage.NewStorageSimpleStreamsDataSource(e.Storage(), storage.BaseToolsPath)}, nil
65+}
66+
67 // Name is specified in the Environ interface.
68 func (env *localEnviron) Name() string {
69 return env.name
70
71=== modified file 'provider/local/environ_test.go'
72--- provider/local/environ_test.go 2013-09-26 09:18:36 +0000
73+++ provider/local/environ_test.go 2013-09-27 00:52:44 +0000
74@@ -7,6 +7,7 @@
75 "io/ioutil"
76 "os"
77 "path/filepath"
78+ "strings"
79
80 gc "launchpad.net/gocheck"
81
82@@ -14,6 +15,8 @@
83 "launchpad.net/juju-core/environs"
84 "launchpad.net/juju-core/environs/config"
85 "launchpad.net/juju-core/environs/jujutest"
86+ envtesting "launchpad.net/juju-core/environs/testing"
87+ "launchpad.net/juju-core/environs/tools"
88 "launchpad.net/juju-core/instance"
89 "launchpad.net/juju-core/provider/local"
90 jc "launchpad.net/juju-core/testing/checkers"
91@@ -21,10 +24,16 @@
92
93 type environSuite struct {
94 baseProviderSuite
95+ envtesting.ToolsFixture
96 }
97
98 var _ = gc.Suite(&environSuite{})
99
100+func (s *environSuite) SetUpTest(c *gc.C) {
101+ s.baseProviderSuite.SetUpTest(c)
102+ s.ToolsFixture.SetUpTest(c)
103+}
104+
105 func (*environSuite) TestOpenFailsWithProtectedDirectories(c *gc.C) {
106 testConfig := minimalConfig(c)
107 testConfig, err := testConfig.Apply(map[string]interface{}{
108@@ -46,6 +55,18 @@
109 c.Assert(environ.PublicStorage(), gc.NotNil)
110 }
111
112+func (s *environSuite) TestGetToolsMetadataSources(c *gc.C) {
113+ testConfig := minimalConfig(c)
114+ environ, err := local.Provider.Open(testConfig)
115+ c.Assert(err, gc.IsNil)
116+ sources, err := tools.GetMetadataSources(environ)
117+ c.Assert(err, gc.IsNil)
118+ c.Assert(len(sources), gc.Equals, 1)
119+ url, err := sources[0].URL("")
120+ c.Assert(err, gc.IsNil)
121+ c.Assert(strings.Contains(url, "/tools"), jc.IsTrue)
122+}
123+
124 func (s *environSuite) TestPrecheck(c *gc.C) {
125 testConfig := minimalConfig(c)
126 environ, err := local.Provider.Open(testConfig)

Subscribers

People subscribed via source and target branches

to status/vote changes: