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

Side by Side Diff: cmd/juju/bootstrap.go

Issue 12232043: Remove control-bucket from environmnts.yaml (Closed)
Patch Set: Remove control-bucket from environmnts.yaml Created 11 years, 8 months ago
Left:
Right:
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 unified diff | Download patch
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package main 4 package main
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "os" 8 "os"
9 "strings" 9 "strings"
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 err = environ.SetConfig(cfg) 97 err = environ.SetConfig(cfg)
98 } 98 }
99 if err != nil { 99 if err != nil {
100 return fmt.Errorf("failed to update environment configur ation: %v", err) 100 return fmt.Errorf("failed to update environment configur ation: %v", err)
101 } 101 }
102 } 102 }
103 err = c.ensureToolsAvailability(environ, context) 103 err = c.ensureToolsAvailability(environ, context)
104 if err != nil { 104 if err != nil {
105 return err 105 return err
106 } 106 }
107 » return environs.Bootstrap(environ, c.Constraints) 107 » err = environs.Bootstrap(environ, c.Constraints)
108 » if err != nil {
109 » » return err
110 » }
111 » // Write out local state, if any, and if not already written.
rog 2013/08/06 13:55:39 I don't know if writing "if not already written" i
wallyworld 2013/08/07 08:02:27 I originally wrote it out all the time but then yo
112 » if lc, ok := environ.Provider().(config.HasLocalConfig); ok {
113 » » if _, err = config.ReadLocalConfig(environ.Config().Name()); err == nil {
rog 2013/08/06 13:55:39 s/=/:=/
114 » » » return nil
115 » » }
116 » » localAttrs := lc.LocalAttrs(environ.Config())
117 » » if len(localAttrs) > 0 {
118 » » » ls := config.NewLocalConfig(localAttrs)
119 » » » err = config.WriteLocalConfig(environ.Config().Name(), l s)
rog 2013/08/06 13:55:39 s/=/:=/
wallyworld 2013/08/07 08:02:27 Done.
120 » » » if err != nil {
121 » » » » return fmt.Errorf("bootstrap succeeded but local state could not be written: %v", err)
122 » » » }
123 » » }
124 » }
125 » return nil
108 } 126 }
109 127
110 // ensureToolsAvailability verifies the tools are available. If no tools are 128 // ensureToolsAvailability verifies the tools are available. If no tools are
111 // found, it will automatically synchronize them. 129 // found, it will automatically synchronize them.
112 func (c *BootstrapCommand) ensureToolsAvailability(env environs.Environ, ctx *cm d.Context) error { 130 func (c *BootstrapCommand) ensureToolsAvailability(env environs.Environ, ctx *cm d.Context) error {
113 // Capture possible logging while syncing and write it on the screen. 131 // Capture possible logging while syncing and write it on the screen.
114 loggo.RegisterWriter("bootstrap", sync.NewSyncLogWriter(ctx.Stdout, ctx. Stderr), loggo.INFO) 132 loggo.RegisterWriter("bootstrap", sync.NewSyncLogWriter(ctx.Stdout, ctx. Stderr), loggo.INFO)
115 defer loggo.RemoveWriter("bootstrap") 133 defer loggo.RemoveWriter("bootstrap")
116 134
117 // Try to find bootstrap tools. 135 // Try to find bootstrap tools.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // probably upload, based on cfg. 175 // probably upload, based on cfg.
158 func getUploadSeries(cfg *config.Config, series []string) []string { 176 func getUploadSeries(cfg *config.Config, series []string) []string {
159 unique := set.NewStrings(series...) 177 unique := set.NewStrings(series...)
160 if unique.IsEmpty() { 178 if unique.IsEmpty() {
161 unique.Add(version.Current.Series) 179 unique.Add(version.Current.Series)
162 unique.Add(config.DefaultSeries) 180 unique.Add(config.DefaultSeries)
163 unique.Add(cfg.DefaultSeries()) 181 unique.Add(cfg.DefaultSeries())
164 } 182 }
165 return unique.Values() 183 return unique.Values()
166 } 184 }
OLDNEW
« no previous file with comments | « [revision details] ('k') | cmd/juju/bootstrap_test.go » ('j') | cmd/juju/bootstrap_test.go » ('J')

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