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.
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
+// GetToolsSources returns a list of sources which are used to search for
simplestreams tools metadata.
+func (e *localEnviron) GetToolsSources() ([]simplestreams.DataSource,
error) {
+ // Add the simplestreams source off the control bucket.
+ return []simplestreams.DataSource{
+ storage.NewStorageSimpleStreamsDataSource(e.Storage(),
storage.BaseToolsPath)}, nil
+}
+
// Name is specified in the Environ interface.
func (env *localEnviron) Name() string {
return env.name
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/~wallyworl d/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): azure/environ. go azure/environ_ test.go local/environ. go local/local_ test.go
A [revision details]
M provider/
M provider/
M provider/
M provider/
Index: [revision details] 20130926184157- 5d305cr4rb895ln t
=== 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-
+New revision: <email address hidden>
Index: provider/ azure/environ. go azure/environ. go' azure/environ. go 2013-09-26 09:18:36 +0000 azure/environ. go 2013-09-27 00:23:48 +0000 s.DataSource, .DataSource{ storage. NewStorageSimpl eStreamsDataSou rce(env. Storage( ), BaseToolsPath) }, nil .DataSource{ NewStorageSimpl eStreamsDataSou rce(env. Storage( ), BaseToolsPath) , NewURLDataSourc e( /jujutools. blob.core. windows. net/juju- tools/tools", VerifySSLHostna mes)}
=== modified file 'provider/
--- provider/
+++ provider/
@@ -918,7 +918,11 @@
// GetToolsSources returns a list of sources which are used to search for
simplestreams tools metadata.
func (env *azureEnviron) GetToolsSources() ([]simplestream
error) {
// Add the simplestreams source off the control bucket.
- return
[]simplestreams
storage.
+ sources := []simplestreams
+ storage.
storage.
+ simplestreams.
+ "https:/
simplestreams.
+ return sources, nil
}
// getImageStream returns the name of the simplestreams stream from which
Index: provider/ azure/environ_ test.go azure/environ_ test.go' azure/environ_ test.go 2013-09-26 12:28:28 +0000 azure/environ_ test.go 2013-09-27 00:23:48 +0000
=== modified file 'provider/
--- provider/
+++ provider/
@@ -1313,6 +1313,9 @@
sources, err := tools.GetMetada taSources( env) len(sources) , gc.Equals, 1) len(sources) , gc.Equals, 2) Contents( c, sources[0], "filename", data) /jujutools. blob.core. windows. net/juju- tools/tools/")
c.Assert(err, gc.IsNil)
- c.Assert(
+ c.Assert(
assertSource
+ url, err := sources[1].URL("")
+ c.Assert(err, gc.IsNil)
+ c.Assert(url,
gc.Equals, "https:/
}
Index: provider/ local/environ. go local/environ. go' local/environ. go 2013-09-26 09:18:36 +0000 local/environ. go 2013-09-27 00:23:48 +0000 net/juju- core/environs/ config" net/juju- core/environs/ filestorage" net/juju- core/environs/ httpstorage" net/juju- core/environs/ simplestreams" net/juju- core/environs/ storage" net/juju- core/environs/ tools" net/juju- core/errors" net/juju- core/instance" net/juju- core/juju/ osenv" (nil)
=== modified file 'provider/
--- provider/
+++ provider/
@@ -23,7 +23,9 @@
"launchpad.
"launchpad.
"launchpad.
+ "launchpad.
"launchpad.
+ envtools "launchpad.
coreerrors "launchpad.
"launchpad.
"launchpad.
@@ -54,6 +56,9 @@
// localEnviron implements Environ.
var _ environs.Environ = (*localEnviron)
+// localEnviron implements SupportsCustomS ources. SupportsCustomS ources = (*localEnviron) (nil) nager
+var _ envtools.
+
type localEnviron struct {
localMutex sync.Mutex
config *environConfig
@@ -63,6 +68,13 @@
containerManager lxc.ContainerMa
}
+// GetToolsSources returns a list of sources which are used to search for s.DataSource, .DataSource{ NewStorageSimpl eStreamsDataSou rce(e.Storage( ), BaseToolsPath) }, nil
simplestreams tools metadata.
+func (e *localEnviron) GetToolsSources() ([]simplestream
error) {
+ // Add the simplestreams source off the control bucket.
+ return []simplestreams
+ storage.
storage.
+}
+
// Name is specified in the Environ interface.
func (env *localEnviron) Name() string {
return env.name
Index: provider/ local/local_ test.go local/local_ test.go' local/local_ test.go 2013-09-20 02:53:59 +0000 local/local_ test.go 2013-09-27 00:23:48 +0000
=== modified file 'provider/
--- provider/
+++ provider/
@@ -4,13 +4,17 @@
package local_test
import (
+ "strings"
stdtesting "testing"
gc "launchpad. net/gocheck"
"launchpad. net/juju- core/environs" net/juju- core/environs/ testing" net/juju- core/environs/ tools" net/juju- core/provider" net/juju- core/provider/ local" net/juju- core/testing/ checkers" net/juju- core/testing/ testbase"
+ envtesting "launchpad.
+ "launchpad.
"launchpad.
"launchpad.
+ jc "launchpad.
"launchpad.
)
@@ -20,12 +24,31 @@
type localSuite struct { LoggingSuite ToolsFixture
testbase.
+ envtesting.
}
var _ = gc.Suite( &localSuite{ })
+func (s *localSuite) SetUpTest(c *gc.C) { SetUpTest( c) SetUpTest( c) istered( c *gc.C) { Provider( provider. Local) provider, gc.DeepEquals, local.Provider) adataSources( c *gc.C) { Open(testConfig ) taSources( environ) len(sources) , gc.Equals, 1) strings. Contains( url, "/tools"), jc.IsTrue)
+ s.LoggingSuite.
+ s.ToolsFixture.
+}
+
func (*localSuite) TestProviderReg
provider, error := environs.
c.Assert(error, gc.IsNil)
c.Assert(
}
+
+func (s *localSuite) TestGetToolsMet
+ testConfig := minimalConfig(c)
+ environ, err := local.Provider.
+ c.Assert(err, gc.IsNil)
+
+ sources, err := tools.GetMetada
+ c.Assert(err, gc.IsNil)
+ c.Assert(
+ url, err := sources[0].URL("")
+ c.Assert(err, gc.IsNil)
+ c.Assert(
+}