@@ -123,24 +123,10 @@ func (env *localEnviron) Bootstrap(
123
123
return "" , "" , nil , err
124
124
}
125
125
126
- configAttrs := env .Config ().AllAttrs ()
127
- toApply := map [string ]interface {}{
126
+ cfg , err := env .Config ().Apply (map [string ]interface {}{
128
127
// Record the bootstrap IP, so the containers know where to go for storage.
129
128
"bootstrap-ip" : env .bridgeAddress ,
130
- }
131
-
132
- setIfNot := func (key string , value interface {}) {
133
- if _ , ok := configAttrs [key ]; ! ok {
134
- toApply [key ] = value
135
- }
136
- }
137
-
138
- // Since Juju's state machine is currently the host machine
139
- // for local providers, don't stomp on it.
140
- setIfNot ("enable-os-refresh-update" , false )
141
- setIfNot ("enable-os-upgrade" , false )
142
-
143
- cfg , err := env .Config ().Apply (toApply )
129
+ })
144
130
if err == nil {
145
131
err = env .SetConfig (cfg )
146
132
}
@@ -159,8 +145,7 @@ func (env *localEnviron) finishBootstrap(ctx environs.BootstrapContext, mcfg *cl
159
145
mcfg .LogDir = fmt .Sprintf ("/var/log/juju-%s" , env .config .namespace ())
160
146
mcfg .Jobs = []params.MachineJob {params .JobManageEnviron }
161
147
mcfg .CloudInitOutputLog = filepath .Join (mcfg .DataDir , "cloud-init-output.log" )
162
- mcfg .EnableOSRefreshUpdate = env .config .Config .EnableOSRefreshUpdate ()
163
- mcfg .EnableOSUpgrade = env .config .Config .EnableOSUpgrade ()
148
+
164
149
mcfg .MachineAgentServiceName = env .machineAgentServiceName ()
165
150
mcfg .AgentEnvironment = map [string ]string {
166
151
agent .Namespace : env .config .namespace (),
@@ -172,10 +157,27 @@ func (env *localEnviron) finishBootstrap(ctx environs.BootstrapContext, mcfg *cl
172
157
// the preallocation faster with no disadvantage.
173
158
agent .MongoOplogSize : "1" , // 1MB
174
159
}
160
+
175
161
if err := environs .FinishMachineConfig (mcfg , env .Config ()); err != nil {
176
162
return err
177
163
}
178
164
165
+ // Since Juju's state machine is currently the host machine
166
+ // for local providers, don't stomp on it.
167
+ cfgAttrs := env .config .AllAttrs ()
168
+ if val , ok := cfgAttrs ["enable-os-refresh-update" ].(bool ); ! ok {
169
+ logger .Infof ("local provider; disabling refreshing OS updates." )
170
+ mcfg .EnableOSRefreshUpdate = false
171
+ } else {
172
+ mcfg .EnableOSRefreshUpdate = val
173
+ }
174
+ if val , ok := cfgAttrs ["enable-os-upgrade" ].(bool ); ! ok {
175
+ logger .Infof ("local provider; disabling OS upgrades." )
176
+ mcfg .EnableOSUpgrade = false
177
+ } else {
178
+ mcfg .EnableOSUpgrade = val
179
+ }
180
+
179
181
// don't write proxy settings for local machine
180
182
mcfg .AptProxySettings = proxy.Settings {}
181
183
mcfg .ProxySettings = proxy.Settings {}
0 commit comments