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

Unified Diff: environs/bootstrap/synctools.go

Issue 77960043: Fix tools upload for local provider. (Closed)
Patch Set: Created 10 years 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 | « environs/bootstrap/bootstrap_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: environs/bootstrap/synctools.go
=== modified file 'environs/bootstrap/synctools.go'
--- environs/bootstrap/synctools.go 2014-03-19 02:55:15 +0000
+++ environs/bootstrap/synctools.go 2014-03-19 22:02:00 +0000
@@ -27,8 +27,10 @@
`
// UploadTools uploads tools for the specified series and any other relevant series to
-// the environment storage, after which it sets the agent-version.
-func UploadTools(env environs.Environ, toolsArch *string, allowRelease bool, bootstrapSeries ...string) error {
+// the environment storage, after which it sets the agent-version. If forceVersion is true,
+// we allow uploading release tools versions and allow uploading even when the agent-version is
+// already set in the environment.
+func UploadTools(env environs.Environ, toolsArch *string, forceVersion bool, bootstrapSeries ...string) error {
logger.Infof("checking that upload is possible")
// Check the series are valid.
for _, series := range bootstrapSeries {
@@ -37,15 +39,15 @@
}
}
// See that we are allowed to upload the tools.
- if err := validateUploadAllowed(env, toolsArch, allowRelease); err != nil {
+ if err := validateUploadAllowed(env, toolsArch, forceVersion); err != nil {
return err
}
cfg := env.Config()
- forceVersion := uploadVersion(version.Current.Number, nil)
+ explicitVersion := uploadVersion(version.Current.Number, nil)
uploadSeries := SeriesToUpload(cfg, bootstrapSeries)
logger.Infof("uploading tools for series %s", uploadSeries)
- tools, err := sync.Upload(env.Storage(), &forceVersion, uploadSeries...)
+ tools, err := sync.Upload(env.Storage(), &explicitVersion, uploadSeries...)
if err != nil {
return err
}
@@ -91,13 +93,14 @@
// validateUploadAllowed returns an error if an attempt to upload tools should
// not be allowed.
-func validateUploadAllowed(env environs.Environ, toolsArch *string, allowRelease bool) error {
- // First, check that there isn't already an agent version specified, and that we
- // are running a development version.
- if _, hasAgentVersion := env.Config().AgentVersion(); hasAgentVersion || (!allowRelease && !version.Current.IsDev()) {
- return fmt.Errorf(noToolsNoUploadMessage)
+func validateUploadAllowed(env environs.Environ, toolsArch *string, forceVersion bool) error {
+ if !forceVersion {
+ // First, check that there isn't already an agent version specified, and that we
+ // are running a development version.
+ if _, hasAgentVersion := env.Config().AgentVersion(); hasAgentVersion || !version.Current.IsDev() {
+ return fmt.Errorf(noToolsNoUploadMessage)
+ }
}
-
// Now check that the architecture for which we are setting up an
// environment matches that from which we are bootstrapping.
hostArch := arch.HostArch()
« no previous file with comments | « environs/bootstrap/bootstrap_test.go ('k') | no next file » | no next file with comments »

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