Skip to content

Commit

Permalink
Merge pull request juju#17456 from jack-w-shaw/hardcode_things
Browse files Browse the repository at this point in the history
juju#17456

We have decided that relying on distro-info to calculated supported bases was a mistake, instead, we should hard code this information into juju.

This means we need to hard code a mapping between bases and series, for the two remaining places in juju we need a series (MAAS & azure). Move this code into `internal/provider/common`. This is ok, since we will will require a code change to support any new controller bases or workload bases anyway.

Hard code ControllerBases and WorkloadBases. We decided recently these were to be hard coded, as the team will always need to work to verify Juju supports a new base. It would be a mistake to support a new base before we know what it may break.

This means we can completely remove checks to distro info! I clean up `core/base` substantially

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing
- [ ] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing
- [ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages

## QA steps

### Bootstrap bases

```
$ juju bootstrap lxd test --bootstrap-base ubuntu@21.04
Creating Juju controller "test" on lxd/localhost
ERROR failed to bootstrap model: use --force to override: ubuntu@21.04/stable not supported

$ juju bootstrap lxd lxd --bootstrap-base ubuntu@21.04 --force
(attempts to bootstrap. However this will probably fail)
```

```
$ juju bootstrap lxd test --bootstrap-base ubuntu@20.04
(success)

$ juju bootstrap lxd test2 --bootstrap-base ubuntu@22.04
(success)
```

### Azure

```
$ juju bootstrap azure azure
$ juju switch controller
$ juju add-machine --base ubuntu@20.04 
$ juju add-machine --base ubuntu@22.04
$ juju status 
Model Controller Cloud/Region Version Timestamp
controller azure azure/centralus 4.0-beta4.1 14:54:34+01:00

App Version Status Scale Charm Channel Rev Exposed Message
controller active 1 juju-controller 4.0/stable 91 no 

Unit Workload Agent Machine Public address Ports Message
controller/0* active idle 0 172.169.204.21 

Machine State Address Inst id Base AZ Message
0 started 172.169.204.21 juju-489299-0 ubuntu@22.04 
1 started 172.169.204.230 juju-489299-1 ubuntu@20.04 
2 started 172.169.204.255 juju-489299-2 ubuntu@22.04 
```

NOTE: There is currently a known bug meaning we can't add new models to Azure
[LP#2068617](https://bugs.launchpad.net/juju/+bug/2068617)

### Workloads

Bootstrap 
```
juju bootstrap lxd lxd
juju add-model m
```

Download and unzip a charm
```
mkdir ubuntu
cd ubuntu
juju download ubuntu
unzip ./ubuntu_r24.charm
cd ..
```

And edit it's manifest such that
```
$ cat ubuntu/manifest.yaml
bases:
- architectures:
 - amd64
 channel: '20.04'
 name: ubuntu
```
i.e. it only support focal ubuntu@20.04

#### Attempt to deploy in various ways
```
$ juju deploy ./ubuntu --base ubuntu@22.04
ERROR base "ubuntu@22.04/stable" is not supported, supported bases are: ubuntu@20.04

$ juju deploy ./ubuntu --base ubuntu@22.04 --force
Located local charm "ubuntu", revision 0
Deploying "ubuntu" from local charm "ubuntu", revision 0 on ubuntu@22.04/stable

$ juju deploy ./ubuntu --base ubuntu@22.04
ERROR base "ubuntu@22.04/stable" is not supported, supported bases are: ubuntu@20.04

$ juju deploy ./ubuntu --base ubuntu@18.04
ERROR ubuntu is not available on the following base: ubuntu@18.04/stable not supported

$ juju deploy ./ubuntu --base ubuntu@21.04
ERROR ubuntu is not available on the following base: ubuntu@21.04/stable not supported

$ juju deploy ./ubuntu --base ubuntu@20.04
Located local charm "ubuntu", revision 2
Deploying "ubuntu" from local charm "ubuntu", revision 2 on ubuntu@20.04/stable
```
  • Loading branch information
jujubot committed Jun 7, 2024
2 parents 8d8968b + ed9f7b0 commit 1162ad7
Show file tree
Hide file tree
Showing 41 changed files with 150 additions and 1,456 deletions.
7 changes: 1 addition & 6 deletions apiserver/facades/client/application/deployrepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strconv"
"sync"

jujuclock "github.com/juju/clock"
"github.com/juju/collections/set"
"github.com/juju/errors"
"github.com/juju/names/v5"
Expand Down Expand Up @@ -842,17 +841,13 @@ func (v *deployFromRepositoryValidator) resolveCharm(ctx context.Context, curl *
if err != nil {
return corecharm.ResolvedDataForDeploy{}, errors.Trace(err)
}
workloadBases, err := corebase.WorkloadBases(jujuclock.WallClock.Now(), requestedBase, modelCfg.ImageStream())
if err != nil {
return corecharm.ResolvedDataForDeploy{}, errors.Trace(err)
}
bsCfg := corecharm.SelectorConfig{
Config: modelCfg,
Force: force,
Logger: v.logger,
RequestedBase: requestedBase,
SupportedCharmBases: supportedBases,
WorkloadBases: workloadBases,
WorkloadBases: corebase.WorkloadBases(),
UsingImageID: cons.HasImageID() || modelCons.HasImageID(),
}
selector, err := corecharm.ConfigureBaseSelector(bsCfg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1648,9 +1648,7 @@ type IsBaseLessThanMachineManagerSuite struct{}
// but complex enough to warrant being exported from an export test package for
// testing.
func (s *IsBaseLessThanMachineManagerSuite) TestIsBaseLessThan(c *gc.C) {
workloadVersions, err := corebase.AllWorkloadVersions()
c.Assert(err, jc.ErrorIsNil)
vers := workloadVersions.Values()
vers := transform.Slice(corebase.WorkloadBases(), func(b corebase.Base) string { return b.Channel.Track })
s.assertSeriesLessThan(c, "ubuntu", vers)
}

Expand Down
31 changes: 19 additions & 12 deletions apiserver/facades/client/modelupgrader/upgrader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package modelupgrader_test

import (
stdcontext "context"
"time"

"github.com/juju/collections/transform"
"github.com/juju/errors"
Expand Down Expand Up @@ -189,8 +188,8 @@ func (s *modelUpgradeSuite) assertUpgradeModelForControllerModelJuju3(c *gc.C, d
},
)

s.PatchValue(&upgradevalidation.SupportedJujuBases, func(time.Time, base.Base, string) ([]base.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.ParseBaseFromString)
s.PatchValue(&upgradevalidation.SupportedJujuBases, func() []base.Base {
return transform.Slice([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.MustParseBaseFromString)
})

ctrlModelTag := coretesting.ModelTag
Expand Down Expand Up @@ -318,8 +317,8 @@ func (s *modelUpgradeSuite) TestUpgradeModelForControllerDyingHostedModelJuju3(c
},
)

s.PatchValue(&upgradevalidation.SupportedJujuBases, func(time.Time, base.Base, string) ([]base.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.ParseBaseFromString)
s.PatchValue(&upgradevalidation.SupportedJujuBases, func() []base.Base {
return transform.Slice([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.MustParseBaseFromString)
})

ctrlModelTag := coretesting.ModelTag
Expand Down Expand Up @@ -427,8 +426,8 @@ func (s *modelUpgradeSuite) TestUpgradeModelForControllerModelJuju3Failed(c *gc.
},
)

s.PatchValue(&upgradevalidation.SupportedJujuBases, func(time.Time, base.Base, string) ([]base.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.ParseBaseFromString)
s.PatchValue(&upgradevalidation.SupportedJujuBases, func() []base.Base {
return transform.Slice([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.MustParseBaseFromString)
})

ctrlModelTag := coretesting.ModelTag
Expand Down Expand Up @@ -553,6 +552,14 @@ func (s *modelUpgradeSuite) assertUpgradeModelJuju3(c *gc.C, ctrlModelVers strin
},
)

s.PatchValue(&upgradevalidation.SupportedJujuBases, func() []base.Base {
return []base.Base{
base.MustParseBaseFromString("ubuntu@24.04"),
base.MustParseBaseFromString("ubuntu@22.04"),
base.MustParseBaseFromString("ubuntu@20.04"),
}
})

modelUUID := coretesting.ModelTag.Id()
model := mocks.NewMockModel(ctrl)
st := mocks.NewMockState(ctrl)
Expand Down Expand Up @@ -588,7 +595,7 @@ func (s *modelUpgradeSuite) assertUpgradeModelJuju3(c *gc.C, ctrlModelVers strin
// - check no upgrade series in process.
st.EXPECT().HasUpgradeSeriesLocks().Return(false, nil)
// - check if the model has deprecated ubuntu machines;
st.EXPECT().MachineCountForBase(makeBases("ubuntu", []string{"20.04/stable", "22.04/stable", "24.04/stable"})).Return(nil, nil)
st.EXPECT().MachineCountForBase(makeBases("ubuntu", []string{"24.04/stable", "22.04/stable", "20.04/stable"})).Return(nil, nil)
st.EXPECT().AllMachinesCount().Return(0, nil)
// - check LXD version.
serverFactory.EXPECT().RemoteServer(s.cloudSpec).Return(server, nil)
Expand Down Expand Up @@ -639,8 +646,8 @@ func (s *modelUpgradeSuite) TestUpgradeModelJuju3Failed(c *gc.C) {
},
)

s.PatchValue(&upgradevalidation.SupportedJujuBases, func(time.Time, base.Base, string) ([]base.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@20.04", "ubuntu@22.04", "ubuntu@24.04"}, base.ParseBaseFromString)
s.PatchValue(&upgradevalidation.SupportedJujuBases, func() []base.Base {
return transform.Slice([]string{"ubuntu@24.04", "ubuntu@22.04", "ubuntu@20.04"}, base.MustParseBaseFromString)
})

modelUUID := coretesting.ModelTag.Id()
Expand Down Expand Up @@ -676,7 +683,7 @@ func (s *modelUpgradeSuite) TestUpgradeModelJuju3Failed(c *gc.C) {
st.EXPECT().HasUpgradeSeriesLocks().Return(true, nil)

// - check if the model has deprecated ubuntu machines;
st.EXPECT().MachineCountForBase(makeBases("ubuntu", []string{"20.04/stable", "22.04/stable", "24.04/stable"})).Return(map[string]int{
st.EXPECT().MachineCountForBase(makeBases("ubuntu", []string{"24.04/stable", "22.04/stable", "20.04/stable"})).Return(map[string]int{
"ubuntu@20.04": 1, "ubuntu@22.04": 2, "ubuntu@24.04": 3,
}, nil)
st.EXPECT().AllMachinesCount().Return(7, nil)
Expand All @@ -700,7 +707,7 @@ func (s *modelUpgradeSuite) TestUpgradeModelJuju3Failed(c *gc.C) {
cannot upgrade to "3.9.99" due to issues with these models:
"admin/model-1":
- unexpected upgrade series lock found
- the model hosts 1 ubuntu machine(s) with an unsupported base. The supported bases are: ubuntu@20.04, ubuntu@22.04, ubuntu@24.04
- the model hosts 1 ubuntu machine(s) with an unsupported base. The supported bases are: ubuntu@24.04, ubuntu@22.04, ubuntu@20.04
- LXD version has to be at least "5.0.0", but current version is only "4.0.0"`[1:])
}

Expand Down
17 changes: 8 additions & 9 deletions cmd/juju/application/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"regexp"
"sort"
"strings"
"time"

"github.com/juju/cmd/v4"
"github.com/juju/cmd/v4/cmdtesting"
Expand Down Expand Up @@ -235,8 +234,8 @@ func (s *DeploySuite) TestDeployFromPathDefaultBase(c *gc.C) {

func (s *DeploySuite) TestDeployFromPathUnsupportedSeriesForce(c *gc.C) {
// Do not remove this because we want to test: bases supported by the charm and bases supported by Juju have overlap.
s.PatchValue(&deployer.SupportedJujuBases, func(time.Time, corebase.Base, string) ([]corebase.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@22.04", "ubuntu@20.04", "ubuntu@12.10"}, corebase.ParseBaseFromString)
s.PatchValue(&deployer.SupportedJujuBases, func() []corebase.Base {
return transform.Slice([]string{"ubuntu@22.04", "ubuntu@20.04", "ubuntu@12.10"}, corebase.MustParseBaseFromString)
})
charmDir := testcharms.RepoWithSeries("bionic").ClonedDir(c.MkDir(), "multi-series")
curl := charm.MustParseURL("local:multi-series-1")
Expand All @@ -249,8 +248,8 @@ func (s *DeploySuite) TestDeployFromPathUnsupportedSeriesForce(c *gc.C) {

func (s *DeploySuite) TestDeployFromPathUnsupportedSeriesHaveOverlap(c *gc.C) {
// Do not remove this because we want to test: bases supported by the charm and bases supported by Juju have overlap.
s.PatchValue(&deployer.SupportedJujuBases, func(time.Time, corebase.Base, string) ([]corebase.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@22.04", "ubuntu@20.04", "ubuntu@12.10"}, corebase.ParseBaseFromString)
s.PatchValue(&deployer.SupportedJujuBases, func() []corebase.Base {
return transform.Slice([]string{"ubuntu@22.04", "ubuntu@20.04", "ubuntu@12.10"}, corebase.MustParseBaseFromString)
})

path := testcharms.RepoWithSeries("bionic").ClonedDirPath(c.MkDir(), "multi-series")
Expand All @@ -261,8 +260,8 @@ func (s *DeploySuite) TestDeployFromPathUnsupportedSeriesHaveOverlap(c *gc.C) {
func (s *DeploySuite) TestDeployFromPathUnsupportedBaseHaveNoOverlap(c *gc.C) {
// Do not remove this because we want to test: bases supported by the charm and bases supported by Juju have NO overlap.
s.PatchValue(&deployer.SupportedJujuBases,
func(time.Time, corebase.Base, string) ([]corebase.Base, error) {
return []corebase.Base{corebase.MustParseBaseFromString("ubuntu@22.10")}, nil
func() []corebase.Base {
return []corebase.Base{corebase.MustParseBaseFromString("ubuntu@22.10")}
},
)

Expand All @@ -273,8 +272,8 @@ func (s *DeploySuite) TestDeployFromPathUnsupportedBaseHaveNoOverlap(c *gc.C) {

func (s *DeploySuite) TestDeployFromPathUnsupportedLXDProfileForce(c *gc.C) {
// TODO remove this patch once we removed all the old bases from tests in current package.
s.PatchValue(&deployer.SupportedJujuBases, func(time.Time, corebase.Base, string) ([]corebase.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@22.04", "ubuntu@20.04", "ubuntu@18.04", "ubuntu@12.10"}, corebase.ParseBaseFromString)
s.PatchValue(&deployer.SupportedJujuBases, func() []corebase.Base {
return transform.Slice([]string{"ubuntu@22.04", "ubuntu@20.04", "ubuntu@18.04", "ubuntu@12.10"}, corebase.MustParseBaseFromString)
})

charmDir := testcharms.RepoWithSeries("quantal").ClonedDir(c.MkDir(), "lxd-profile-fail")
Expand Down
12 changes: 2 additions & 10 deletions cmd/juju/application/deployer/bundlehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,17 +648,13 @@ func (h *bundleHandler) addCharm(change *bundlechanges.AddCharmChange) error {
if resolvedOrigin.Type == "bundle" {
return errors.Errorf("expected charm, got bundle %q %v", ch.Name, resolvedOrigin)
}
workloadBases, err := SupportedJujuBases(jujuclock.WallClock.Now(), base, h.modelConfig.ImageStream())
if err != nil {
return errors.Trace(err)
}
selector, err := corecharm.ConfigureBaseSelector(corecharm.SelectorConfig{
Config: h.modelConfig,
Force: h.force,
Logger: logger,
RequestedBase: base,
SupportedCharmBases: supportedBases,
WorkloadBases: workloadBases,
WorkloadBases: SupportedJujuBases(),
})
if err != nil {
return errors.Trace(err)
Expand Down Expand Up @@ -980,17 +976,13 @@ func (h *bundleHandler) selectedBase(ch charm.CharmMeta, chBase corebase.Base) (
if err != nil {
return corebase.Base{}, errors.Trace(err)
}
workloadBases, err := SupportedJujuBases(jujuclock.WallClock.Now(), chBase, h.modelConfig.ImageStream())
if err != nil {
return corebase.Base{}, errors.Trace(err)
}
selector, err := corecharm.ConfigureBaseSelector(corecharm.SelectorConfig{
Config: h.modelConfig,
Force: h.force,
Logger: logger,
RequestedBase: chBase,
SupportedCharmBases: supportedBases,
WorkloadBases: workloadBases,
WorkloadBases: SupportedJujuBases(),
})
if err != nil {
return corebase.Base{}, errors.Trace(err)
Expand Down
5 changes: 2 additions & 3 deletions cmd/juju/application/deployer/bundlehandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"context"
"fmt"
"strings"
"time"

"github.com/juju/cmd/v4"
"github.com/juju/collections/set"
Expand Down Expand Up @@ -64,8 +63,8 @@ func (s *BundleDeployRepositorySuite) SetUpTest(_ *gc.C) {
s.deployArgs = make(map[string]application.DeployArgs)
s.output = bytes.NewBuffer([]byte{})

s.PatchValue(&SupportedJujuBases, func(time.Time, corebase.Base, string) ([]corebase.Base, error) {
return transform.SliceOrErr([]string{"ubuntu@20.04", "ubuntu@22.04", "ubuntu@24.04"}, corebase.ParseBaseFromString)
s.PatchValue(&SupportedJujuBases, func() []corebase.Base {
return transform.Slice([]string{"ubuntu@20.04", "ubuntu@22.04", "ubuntu@24.04"}, corebase.MustParseBaseFromString)
})
}

Expand Down
18 changes: 3 additions & 15 deletions cmd/juju/application/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,13 @@ func (d *factory) localPreDeployedCharmDeployer(getter ModelConfigGetter) (Deplo

func (d *factory) determineBaseForLocalCharm(ch charm.Charm, getter ModelConfigGetter) (corebase.Base, string, error) {
var (
imageStream string
selectedBase corebase.Base
)
modelCfg, err := getModelConfig(getter)
if err != nil {
return corebase.Base{}, "", errors.Trace(err)
}

imageStream = modelCfg.ImageStream()
workloadBases, err := SupportedJujuBases(d.clock.Now(), d.base, imageStream)
if err != nil {
return corebase.Base{}, "", errors.Trace(err)
}

supportedBases, err := corecharm.ComputedBases(ch)
if err != nil {
return corebase.Base{}, "", errors.Trace(err)
Expand All @@ -304,7 +297,7 @@ func (d *factory) determineBaseForLocalCharm(ch charm.Charm, getter ModelConfigG
Logger: logger,
RequestedBase: d.base,
SupportedCharmBases: supportedBases,
WorkloadBases: workloadBases,
WorkloadBases: SupportedJujuBases(),
UsingImageID: d.constraints.HasImageID() || d.modelConstraints.HasImageID(),
})
if err != nil {
Expand All @@ -315,7 +308,7 @@ func (d *factory) determineBaseForLocalCharm(ch charm.Charm, getter ModelConfigG
if err = charmValidationError(ch.Meta().Name, errors.Trace(err)); err != nil {
return corebase.Base{}, "", errors.Trace(err)
}
return selectedBase, imageStream, nil
return selectedBase, modelCfg.ImageStream(), nil
}

func (d *factory) checkHandleRevision(userCharmURL *charm.URL, charmHubSchemaCheck bool) (int, error) {
Expand Down Expand Up @@ -666,12 +659,7 @@ func (d *factory) validateCharmBase(base corebase.Base, imageStream string) erro
}
// attempt to locate the charm base from the list of known juju bases
// that we currently support.
workloadBases, err := SupportedJujuBases(d.clock.Now(), base, imageStream)
if err != nil {
return errors.Trace(err)
}

for _, workloadBase := range workloadBases {
for _, workloadBase := range SupportedJujuBases() {
if workloadBase == base {
return nil
}
Expand Down
17 changes: 3 additions & 14 deletions cmd/juju/commands/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,6 @@ var getBootstrapFuncs = func() BootstrapInterface {
return &bootstrapFuncs{}
}

var supportedJujuBases = corebase.ControllerBases

var (
bootstrapPrepareController = bootstrap.PrepareController
environsDestroy = environs.Destroy
Expand Down Expand Up @@ -771,18 +769,6 @@ func (c *bootstrapCommand) Run(ctx *cmd.Context) (resultErr error) {
}
}

// Get the supported bootstrap series.
var imageStream string
if cfg, ok := bootstrapCfg.bootstrapModel["image-stream"]; ok {
imageStream = cfg.(string)
}
now := c.clock.Now()
supportedBootstrapBases, err := supportedJujuBases(now, bootstrapBase, imageStream)
if err != nil {
return errors.Annotate(err, "error reading supported bootstrap series")
}
logger.Tracef("supported bootstrap bases %v", supportedBootstrapBases)

bootstrapCfg.controller[controller.ControllerName] = c.controllerName

// Handle Ctrl-C during bootstrap by asking the bootstrap process to stop
Expand Down Expand Up @@ -889,6 +875,9 @@ to create a new model to deploy %sworkloads.
}
}

supportedBootstrapBases := corebase.ControllerBases()
logger.Tracef("supported bootstrap bases %v", supportedBootstrapBases)

bootstrapParams := bootstrap.BootstrapParams{
ControllerName: c.controllerName,
BootstrapBase: bootstrapBase,
Expand Down
9 changes: 0 additions & 9 deletions cmd/juju/commands/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"github.com/juju/cmd/v4/cmdtesting"
"github.com/juju/errors"
"github.com/juju/loggo/v2"
jujuos "github.com/juju/os/v2"
osseries "github.com/juju/os/v2/series"
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils/v4"
Expand Down Expand Up @@ -118,12 +116,6 @@ func init() {
func (s *BootstrapSuite) SetUpSuite(c *gc.C) {
s.FakeJujuXDGDataHomeSuite.SetUpSuite(c)
s.PatchValue(&keys.JujuPublicKey, sstesting.SignedMetadataPublicKey)
s.PatchValue(
&corebase.LocalSeriesVersionInfo,
func() (jujuos.OSType, map[string]osseries.SeriesVersionInfo, error) {
return jujuos.Ubuntu, nil, nil
},
)
}

func (s *BootstrapSuite) SetUpTest(c *gc.C) {
Expand All @@ -136,7 +128,6 @@ func (s *BootstrapSuite) SetUpTest(c *gc.C) {
s.PatchValue(&jujuversion.Current, v100u64.Number)
s.PatchValue(&arch.HostArch, func() string { return v100u64.Arch })
s.PatchValue(&coreos.HostOS, func() ostype.OSType { return ostype.Ubuntu })
s.PatchValue(&corebase.UbuntuDistroInfo, "/path/notexists")

// Ensure KUBECONFIG doesn't interfere with tests.
s.PatchEnvironment(k8scmd.RecommendedConfigPathEnvVar, filepath.Join(c.MkDir(), "config"))
Expand Down
2 changes: 0 additions & 2 deletions cmd/jujud-controller/agent/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/juju/juju/cloud"
"github.com/juju/juju/cmd/jujud-controller/agent/agenttest"
"github.com/juju/juju/controller"
corebase "github.com/juju/juju/core/base"
"github.com/juju/juju/core/constraints"
"github.com/juju/juju/core/instance"
corelogger "github.com/juju/juju/core/logger"
Expand Down Expand Up @@ -108,7 +107,6 @@ func (s *BootstrapSuite) SetUpTest(c *gc.C) {
s.PatchValue(&sshGenerateKey, func(name string) (string, string, error) {
return "private-key", "public-key", nil
})
s.PatchValue(&corebase.UbuntuDistroInfo, "/path/notexists")

s.MgoSuite.SetUpTest(c)
s.dataDir = c.MkDir()
Expand Down

0 comments on commit 1162ad7

Please sign in to comment.