Example #1
File: conn.go Project: bac/juju
// DefaultVersions returns a slice of unique 'versions' for the current
// environment's preferred series and host architecture, as well supported LTS
// series for the host architecture. Additionally, it ensures that 'versions'
// for amd64 are returned if that is not the current host's architecture.
func DefaultVersions(conf *config.Config) []version.Binary {
	var versions []version.Binary
	supported := series.SupportedLts()
	defaultSeries := set.NewStrings(supported...)
	agentVersion, set := conf.AgentVersion()
	if !set {
		agentVersion = jujuversion.Current
	for _, s := range defaultSeries.Values() {
		versions = append(versions, version.Binary{
			Number: agentVersion,
			Arch:   arch.HostArch(),
			Series: s,
		if arch.HostArch() != "amd64" {
			versions = append(versions, version.Binary{
				Number: agentVersion,
				Arch:   "amd64",
				Series: s,

	return versions
func (s *supportedSeriesSuite) TestSupportedLts(c *gc.C) {
	got := series.SupportedLts()
	want := []string{"precise", "trusty", "xenial"}
	c.Assert(got, gc.DeepEquals, want)
Example #3
File: tools.go Project: bac/juju
	agenttools "github.com/juju/juju/agent/tools"
	sstesting "github.com/juju/juju/environs/simplestreams/testing"
	envtools "github.com/juju/juju/environs/tools"
	coretesting "github.com/juju/juju/testing"
	coretools "github.com/juju/juju/tools"
	jujuversion "github.com/juju/juju/version"

// toolsltsseries records the known ubuntu lts series.
var toolsLtsSeries = series.SupportedLts()

// ToolsFixture is used as a fixture to stub out the default tools URL so we
// don't hit the real internet during tests.
type ToolsFixture struct {
	origDefaultURL string
	DefaultBaseURL string

	// UploadArches holds the architectures of tools to
	// upload in UploadFakeTools. If empty, it will default
	// to just arch.HostArch()
	UploadArches []string

func (s *ToolsFixture) SetUpTest(c *gc.C) {
	s.origDefaultURL = envtools.DefaultBaseURL