Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(515)

Unified Diff: cmd/juju/synctools.go

Issue 8545043: environs: extract tools package
Patch Set: environs: extract tools package Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cmd/juju/main_test.go ('k') | cmd/juju/synctools_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cmd/juju/synctools.go
=== modified file 'cmd/juju/synctools.go'
--- cmd/juju/synctools.go 2013-04-11 17:51:37 +0000
+++ cmd/juju/synctools.go 2013-04-12 12:50:52 +0000
@@ -7,6 +7,7 @@
"launchpad.net/gnuflag"
"launchpad.net/juju-core/cmd"
"launchpad.net/juju-core/environs"
+ "launchpad.net/juju-core/environs/tools"
"launchpad.net/juju-core/log"
"launchpad.net/juju-core/state"
"launchpad.net/juju-core/version"
@@ -64,9 +65,9 @@
tool *state.Tools, source environs.StorageReader,
target environs.Storage, ctx *cmd.Context,
) error {
- toolsPath := environs.ToolsStoragePath(tool.Binary)
- fmt.Fprintf(ctx.Stderr, "copying %v", toolsPath)
- srcFile, err := source.Get(toolsPath)
+ toolsName := tools.StorageName(tool.Binary)
+ fmt.Fprintf(ctx.Stderr, "copying %v", toolsName)
+ srcFile, err := source.Get(toolsName)
if err != nil {
return err
}
@@ -78,10 +79,10 @@
if err != nil {
return err
}
- log.Infof("downloaded %v (%dkB), uploading", toolsPath, (nBytes+512)/1024)
+ log.Infof("downloaded %v (%dkB), uploading", toolsName, (nBytes+512)/1024)
fmt.Fprintf(ctx.Stderr, ", download %dkB, uploading\n", (nBytes+512)/1024)
- if err := target.Put(toolsPath, buf, nBytes); err != nil {
+ if err := target.Put(toolsName, buf, nBytes); err != nil {
return err
}
return nil
@@ -133,9 +134,6 @@
if err != nil {
return err
}
- for _, tool := range targetToolsList.Private {
- log.Debugf("found target tool: %s", tool)
- }
targetTools := targetToolsList.Private
targetStorage := targetEnv.Storage()
if c.publicBucket {
@@ -144,7 +142,9 @@
if targetStorage, ok = targetEnv.PublicStorage().(environs.Storage); !ok {
return fmt.Errorf("Cannot write to PublicStorage")
}
-
+ }
+ for _, tool := range targetTools {
+ log.Debugf("found target tool: %s", tool)
}
missing := toolsToCopy.Exclude(targetTools)
fmt.Fprintf(ctx.Stdout, "found %d tools in target; %d tools to be copied\n",
« no previous file with comments | « cmd/juju/main_test.go ('k') | cmd/juju/synctools_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b