Skip to content

Commit

Permalink
Update user facing messages to reference 'agent binaries' instead of …
Browse files Browse the repository at this point in the history
…'tools'.
  • Loading branch information
hmlanigan committed May 24, 2017
1 parent 074ca56 commit ac09806
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion cmd/juju/commands/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ func (s *BootstrapSuite) TestInvalidLocalSource(c *gc.C) {
"Looking for packaged Juju agent version 1.2.0 for amd64\n",
)
c.Check(s.tw.Log(), jc.LogMatches, []jc.SimpleMessage{
{loggo.ERROR, "failed to bootstrap model: no matching tools available"},
{loggo.ERROR, "failed to bootstrap model: no matching agent binaries available"},
})
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/commands/upgradejuju.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func (c *upgradeJujuCommand) initVersions(client upgradeJujuAPI, cfg *config.Con
// the current client version.
filterVersion.Major--
}
logger.Debugf("searching for tools with major: %d", filterVersion.Major)
logger.Debugf("searching for agent binaries with major: %d", filterVersion.Major)
findResult, err := client.FindTools(filterVersion.Major, -1, "", "")
if err != nil {
return nil, err
Expand Down
10 changes: 5 additions & 5 deletions cmd/juju/commands/upgradejuju_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,35 +184,35 @@ var upgradeJujuTests = []struct {
currentVersion: "3.0.0-quantal-amd64",
agentVersion: "3.0.0",
args: []string{"--agent-version", "3.2.0"},
expectErr: "no tools available",
expectErr: "no agent binaries available",
}, {
about: "specified version, no matching major version",
tools: []string{"4.2.0-quantal-amd64"},
currentVersion: "3.0.0-quantal-amd64",
agentVersion: "3.0.0",
args: []string{"--agent-version", "3.2.0"},
expectErr: "no matching tools available",
expectErr: "no matching agent binaries available",
}, {
about: "specified version, no matching minor version",
tools: []string{"3.4.0-quantal-amd64"},
currentVersion: "3.0.0-quantal-amd64",
agentVersion: "3.0.0",
args: []string{"--agent-version", "3.2.0"},
expectErr: "no matching tools available",
expectErr: "no matching agent binaries available",
}, {
about: "specified version, no matching patch version",
tools: []string{"3.2.5-quantal-amd64"},
currentVersion: "3.0.0-quantal-amd64",
agentVersion: "3.0.0",
args: []string{"--agent-version", "3.2.0"},
expectErr: "no matching tools available",
expectErr: "no matching agent binaries available",
}, {
about: "specified version, no matching build version",
tools: []string{"3.2.0.2-quantal-amd64"},
currentVersion: "3.0.0-quantal-amd64",
agentVersion: "3.0.0",
args: []string{"--agent-version", "3.2.0"},
expectErr: "no matching tools available",
expectErr: "no matching agent binaries available",
}, {
about: "incompatible version (minor != 0)",
tools: []string{"3.2.0-quantal-amd64"},
Expand Down
8 changes: 4 additions & 4 deletions cmd/jujud/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (c *BootstrapCommand) Run(_ *cmd.Context) error {
// If we have been asked for a newer version, ensure the newer
// tools can actually be found, or else bootstrap won't complete.
stream := envtools.PreferredStream(&desiredVersion, args.ControllerModelConfig.Development(), args.ControllerModelConfig.AgentStream())
logger.Infof("newer tools requested, looking for %v in stream %v", desiredVersion, stream)
logger.Infof("newer agent binaries requested, looking for %v in stream %v", desiredVersion, stream)
hostSeries, err := series.HostSeries()
if err != nil {
return errors.Trace(err)
Expand All @@ -163,12 +163,12 @@ func (c *BootstrapCommand) Run(_ *cmd.Context) error {
}
_, toolsErr := envtools.FindTools(env, -1, -1, stream, filter)
if toolsErr == nil {
logger.Infof("tools are available, upgrade will occur after bootstrap")
logger.Infof("agent binaries are available, upgrade will occur after bootstrap")
}
if errors.IsNotFound(toolsErr) {
// Newer tools not available, so revert to using the tools
// matching the current agent version.
logger.Warningf("newer tools for %q not available, sticking with version %q", desiredVersion, jujuversion.Current)
logger.Warningf("newer agent binaries for %q not available, sticking with version %q", desiredVersion, jujuversion.Current)
newConfigAttrs["agent-version"] = jujuversion.Current.String()
} else if toolsErr != nil {
logger.Errorf("cannot find newer tools: %v", toolsErr)
Expand Down Expand Up @@ -423,7 +423,7 @@ func (c *BootstrapCommand) populateTools(st *state.State, env environs.Environ)
Size: tools.Size,
SHA256: tools.SHA256,
}
logger.Debugf("Adding tools: %v", toolsVersion)
logger.Debugf("Adding agent binaries: %v", toolsVersion)
if err := toolstorage.Add(bytes.NewReader(data), metadata); err != nil {
return errors.Trace(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/plugins/juju-metadata/toolsmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *toolsMetadataCommand) Run(context *cmd.Context) error {
return errors.Trace(err)
}

fmt.Fprintf(context.Stdout, "Finding tools in %s for stream %s.\n", c.metadataDir, c.stream)
fmt.Fprintf(context.Stdout, "Finding agent binaries in %s for stream %s.\n", c.metadataDir, c.stream)
toolsList, err := envtools.ReadList(sourceStorage, c.stream, -1, -1)
if err == envtools.ErrNoTools {
var source string
Expand Down
14 changes: 7 additions & 7 deletions cmd/plugins/juju-metadata/toolsmetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ var versionStrings = append([]string{
var expectedOutputCommon = makeExpectedOutputCommon()

func makeExpectedOutputCommon() string {
expected := "Finding tools in .*\n"
f := `.*Fetching tools from dir "{{.ToolsDir}}" to generate hash: %s` + "\n"
expected := "Finding agent binaries in .*\n"
f := `.*Fetching agent binaries from dir "{{.ToolsDir}}" to generate hash: %s` + "\n"

// Sort the global versionStrings
sort.Strings(versionStrings)
Expand Down Expand Up @@ -296,9 +296,9 @@ func (s *ToolsMetadataSuite) TestNoTools(c *gc.C) {
code := cmd.Main(newToolsMetadataCommand(), ctx, nil)
c.Assert(code, gc.Equals, 1)
stdout := ctx.Stdout.(*bytes.Buffer).String()
c.Assert(stdout, gc.Matches, ".*Finding tools in .*\n")
c.Assert(stdout, gc.Matches, ".*Finding agent binaries in .*\n")
stderr := ctx.Stderr.(*bytes.Buffer).String()
c.Assert(stderr, gc.Matches, "ERROR no tools available\n")
c.Assert(stderr, gc.Matches, "ERROR no agent binaries available\n")
}

func (s *ToolsMetadataSuite) TestPatchLevels(c *gc.C) {
Expand All @@ -318,9 +318,9 @@ func (s *ToolsMetadataSuite) TestPatchLevels(c *gc.C) {
c.Assert(code, gc.Equals, 0)
output := ctx.Stdout.(*bytes.Buffer).String()
expectedOutput := fmt.Sprintf(`
Finding tools in .*
.*Fetching tools from dir "released" to generate hash: %s
.*Fetching tools from dir "released" to generate hash: %s
Finding agent binaries in .*
.*Fetching agent binaries from dir "released" to generate hash: %s
.*Fetching agent binaries from dir "released" to generate hash: %s
.*Writing tools/streams/v1/index2\.json
.*Writing tools/streams/v1/index\.json
.*Writing tools/streams/v1/com\.ubuntu\.juju-released-tools\.json
Expand Down
6 changes: 3 additions & 3 deletions environs/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ func getBootstrapToolsVersion(possibleTools coretools.List) (coretools.List, err
bootstrapVersion, toolsList = compatibleVersion, compatibleTools
}
}
logger.Infof("picked bootstrap tools version: %s", bootstrapVersion)
logger.Infof("picked bootstrap agent binary version: %s", bootstrapVersion)
return toolsList, nil
}

Expand Down Expand Up @@ -680,8 +680,8 @@ func setPrivateMetadataSources(metadataDir string) ([]*imagemetadata.ImageMetada
logger.Debugf("no agent directory found, using default agent binary metadata source: %s", tools.DefaultBaseURL)
} else {
if ending == storage.BaseToolsPath {
// as the specified metadataDir ended in 'tools'
// assume that is the only metadata to find and return
// As the specified metadataDir ended in 'tools'
// assume that is the only metadata to find and return.
tools.DefaultBaseURL = filepath.Dir(metadataDir)
logger.Debugf("setting default agent binary metadata source: %s", tools.DefaultBaseURL)
return nil, nil
Expand Down
20 changes: 10 additions & 10 deletions environs/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func SyncTools(syncContext *SyncContext) error {
return errors.Trace(err)
}

logger.Infof("listing available tools")
logger.Infof("listing available agent binaries")
if syncContext.MajorVersion == 0 && syncContext.MinorVersion == 0 {
syncContext.MajorVersion = jujuversion.Current.Major
syncContext.MinorVersion = -1
Expand Down Expand Up @@ -111,29 +111,29 @@ func SyncTools(syncContext *SyncContext) error {
return errors.Trace(err)
}

logger.Infof("found %d tools", len(sourceTools))
logger.Infof("found %d agent binaries", len(sourceTools))
if !syncContext.AllVersions {
var latest version.Number
latest, sourceTools = sourceTools.Newest()
logger.Infof("found %d recent tools (version %s)", len(sourceTools), latest)
logger.Infof("found %d recent agent binaries (version %s)", len(sourceTools), latest)
}
for _, tool := range sourceTools {
logger.Debugf("found source tool: %v", tool)
}

logger.Infof("listing target tools storage")
logger.Infof("listing target agent binaries storage")
targetTools, err := syncContext.TargetToolsFinder.FindTools(syncContext.MajorVersion, syncContext.Stream)
switch err {
case nil, coretools.ErrNoMatches, envtools.ErrNoTools:
default:
return errors.Trace(err)
}
for _, tool := range targetTools {
logger.Debugf("found target tool: %v", tool)
logger.Debugf("found target agent binary: %v", tool)
}

missing := sourceTools.Exclude(targetTools)
logger.Infof("found %d tools in target; %d tools to be copied", len(targetTools), len(missing))
logger.Infof("found %d agent binaries in target; %d agent binaries to be copied", len(targetTools), len(missing))
if syncContext.DryRun {
for _, tools := range missing {
logger.Infof("copying %s from %s", tools.Version, tools.URL)
Expand All @@ -145,7 +145,7 @@ func SyncTools(syncContext *SyncContext) error {
if err != nil {
return err
}
logger.Infof("copied %d tools", len(missing))
logger.Infof("copied %d agent binaries", len(missing))
return nil
}

Expand All @@ -159,7 +159,7 @@ func selectSourceDatasource(syncContext *SyncContext) (simplestreams.DataSource,
if err != nil {
return nil, err
}
logger.Infof("using sync tools source: %v", sourceURL)
logger.Infof("source for sync of agent binaries: %v", sourceURL)
return simplestreams.NewURLSignedDataSource("sync tools source", sourceURL, keys.JujuPublicKey, utils.VerifySSLHostnames, simplestreams.CUSTOM_CLOUD_DATA, false), nil
}

Expand Down Expand Up @@ -273,7 +273,7 @@ func cloneToolsForSeries(toolsInfo *BuiltAgent, stream string, series ...string)
if err != nil {
return err
}
logger.Debugf("generating tools metadata")
logger.Debugf("generating agent binary metadata")
return envtools.MergeAndWriteMetadata(metadataStore, stream, stream, targetTools, false)
}

Expand Down Expand Up @@ -421,7 +421,7 @@ func (u StorageToolsUploader) UploadTools(toolsDir, stream string, tools *coreto
}
err := envtools.MergeAndWriteMetadata(u.Storage, toolsDir, stream, coretools.List{tools}, u.WriteMirrors)
if err != nil {
logger.Errorf("error writing tools metadata: %v", err)
logger.Errorf("error writing agent binary metadata: %v", err)
return err
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion environs/tools/simplestreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func ResolveMetadata(stor storage.StorageReader, toolsDir string, metadata []*To
if err != nil {
return errors.Annotate(err, "cannot resolve metadata")
}
logger.Infof("Fetching tools from dir %q to generate hash: %v", toolsDir, binary)
logger.Infof("Fetching agent binaries from dir %q to generate hash: %v", toolsDir, binary)
size, sha256hash, err := fetchToolsHash(stor, toolsDir, binary)
// Older versions of Juju only know about ppc64, not ppc64el,
// so if there's no metadata for ppc64, dd metadata for that arch.
Expand Down
6 changes: 3 additions & 3 deletions environs/tools/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
coretools "github.com/juju/juju/tools"
)

var ErrNoTools = errors.New("no tools available")
var ErrNoTools = errors.New("no agent binaries available")

const (
toolPrefix = "tools/%s/juju-"
Expand All @@ -39,9 +39,9 @@ func storagePrefix(stream string) string {
// If store contains no such tools, it returns ErrNoMatches.
func ReadList(stor storage.StorageReader, toolsDir string, majorVersion, minorVersion int) (coretools.List, error) {
if minorVersion >= 0 {
logger.Debugf("reading v%d.%d tools", majorVersion, minorVersion)
logger.Debugf("reading v%d.%d agent binaries", majorVersion, minorVersion)
} else {
logger.Debugf("reading v%d.* tools", majorVersion)
logger.Debugf("reading v%d.* agent binaries", majorVersion)
}
storagePrefix := storagePrefix(toolsDir)
names, err := storage.List(stor, storagePrefix)
Expand Down
2 changes: 1 addition & 1 deletion provider/azure/environ.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func (env *azureEnviron) StartInstance(args environs.StartInstanceParams) (*envi
if err != nil {
return nil, errors.Trace(err)
}
logger.Infof("picked tools %q", selectedTools[0].Version)
logger.Infof("picked agent binaries %q", selectedTools[0].Version)

// Finalize the instance config, which we'll render to CustomData below.
if err := args.InstanceConfig.SetTools(selectedTools); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions provider/dummy/environs.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ func (e *environ) Bootstrap(ctx environs.BootstrapContext, args environs.Bootstr
return nil, errors.New("no CA certificate in controller configuration")
}

logger.Infof("would pick tools from %s", availableTools)
logger.Infof("would pick agent binaries from %s", availableTools)

estate, err := e.state()
if err != nil {
Expand Down Expand Up @@ -992,7 +992,7 @@ func (e *environ) StartInstance(args environs.StartInstanceParams) (*environs.St
if args.InstanceConfig.APIInfo.Tag != names.NewMachineTag(machineId) {
return nil, errors.New("entity tag must match started machine")
}
logger.Infof("would pick tools from %s", args.Tools)
logger.Infof("would pick agent binaries from %s", args.Tools)
series := args.Tools.OneSeries()

idString := fmt.Sprintf("%s-%d", e.name, estate.maxId)
Expand Down
2 changes: 1 addition & 1 deletion provider/lxd/environ_broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *environBrokerSuite) TestStartInstanceNoTools(c *gc.C) {
s.PatchValue(&arch.HostArch, func() string { return arch.PPC64EL })

_, err := s.Env.StartInstance(s.StartInstArgs)
c.Assert(err, gc.ErrorMatches, "no matching tools available")
c.Assert(err, gc.ErrorMatches, "no matching agent binaries available")
}

func (s *environBrokerSuite) TestStopInstances(c *gc.C) {
Expand Down
2 changes: 1 addition & 1 deletion provider/oracle/environ.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (o *OracleEnviron) StartInstance(args environs.StartInstanceParams) (*envir
if err != nil {
return nil, errors.Trace(err)
}
logger.Tracef("Tools: %v", tools)
logger.Tracef("agent binaries: %v", tools)
if err = args.InstanceConfig.SetTools(tools); err != nil {
return nil, errors.Trace(err)
}
Expand Down
2 changes: 1 addition & 1 deletion tools/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// a List is not significant.
type List []*Tools

var ErrNoMatches = errors.New("no matching tools available")
var ErrNoMatches = errors.New("no matching agent binaries available")

// String returns the versions of the tools in src, separated by semicolons.
func (src List) String() string {
Expand Down
4 changes: 2 additions & 2 deletions worker/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@ func (s *ProvisionerSuite) TestProvisionerSetsErrorStatusWhenNoToolsAreAvailable
// Ensure machine error status was set, and the error matches
agentStatus, instanceStatus := s.waitUntilMachineNotPending(c, m)
c.Check(agentStatus.Status, gc.Equals, status.Error)
c.Check(agentStatus.Message, gc.Equals, "no matching tools available")
c.Check(agentStatus.Message, gc.Equals, "no matching agent binaries available")
c.Check(instanceStatus.Status, gc.Equals, status.ProvisioningError)
c.Check(instanceStatus.Message, gc.Equals, "no matching tools available")
c.Check(instanceStatus.Message, gc.Equals, "no matching agent binaries available")

// Restart the PA to make sure the machine is skipped again.
stop(c, p)
Expand Down
8 changes: 4 additions & 4 deletions worker/upgrader/upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (u *Upgrader) loop() error {
if err == nil {
return u.newUpgradeReadyError(wantTools.Version)
}
logger.Errorf("failed to fetch tools from %q: %v", wantTools.URL, err)
logger.Errorf("failed to fetch agent binaries from %q: %v", wantTools.URL, err)
}
retry = retryAfter()
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (u *Upgrader) newUpgradeReadyError(newVersion version.Binary) *UpgradeReady
}

func (u *Upgrader) ensureTools(agentTools *coretools.Tools) error {
logger.Infof("fetching tools from %q", agentTools.URL)
logger.Infof("fetching agent binaries from %q", agentTools.URL)
// The reader MUST verify the tools' hash, so there is no
// need to validate the peer. We cannot anyway: see http://pad.lv/1261780.
resp, err := utils.GetNonValidatingHTTPClient().Get(agentTools.URL)
Expand All @@ -263,8 +263,8 @@ func (u *Upgrader) ensureTools(agentTools *coretools.Tools) error {
}
err = agenttools.UnpackTools(u.dataDir, agentTools, resp.Body)
if err != nil {
return fmt.Errorf("cannot unpack tools: %v", err)
return fmt.Errorf("cannot unpack agent binaries: %v", err)
}
logger.Infof("unpacked tools %s to %s", agentTools.Version, u.dataDir)
logger.Infof("unpacked agent binaries %s to %s", agentTools.Version, u.dataDir)
return nil
}

0 comments on commit ac09806

Please sign in to comment.