LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 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 local | 4 package local |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 "net" | 8 "net" |
9 "os" | 9 "os" |
10 "os/exec" | 10 "os/exec" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 // don't write proxy settings for local machine | 168 // don't write proxy settings for local machine |
169 mcfg.AptProxySettings = osenv.ProxySettings{} | 169 mcfg.AptProxySettings = osenv.ProxySettings{} |
170 mcfg.ProxySettings = osenv.ProxySettings{} | 170 mcfg.ProxySettings = osenv.ProxySettings{} |
171 cloudcfg := coreCloudinit.New() | 171 cloudcfg := coreCloudinit.New() |
172 // Since rsyslogd is restricted by apparmor to only write to /var/log/** | 172 // Since rsyslogd is restricted by apparmor to only write to /var/log/** |
173 // we now provide a symlink to the written file in the local log dir. | 173 // we now provide a symlink to the written file in the local log dir. |
174 // Also, we leave the old all-machines.log file in | 174 // Also, we leave the old all-machines.log file in |
175 // /var/log/juju-{{namespace}} until we start the environment again. So | 175 // /var/log/juju-{{namespace}} until we start the environment again. So |
176 // potentially remove it at the start of the cloud-init. | 176 // potentially remove it at the start of the cloud-init. |
177 » logfile := fmt.Sprintf("/var/log/juju-%s/all-machines.log", env.config.n
amespace()) | 177 » logLocation := fmt.Sprintf("/var/log/juju-%s/all-machines.log", env.conf
ig.namespace()) |
| 178 » mcfg.Config, err = mcfg.Config.Apply(map[string]interface{}{"log-locatio
n": logLocation}) |
| 179 » if err != nil { |
| 180 » » return err |
| 181 » } |
178 cloudcfg.AddScripts( | 182 cloudcfg.AddScripts( |
179 » » fmt.Sprintf("[ -f %s ] && rm %s", logfile, logfile), | 183 » » fmt.Sprintf("[ -f %s ] && rm %s", logLocation, logLocation), |
180 » » fmt.Sprintf("ln -s %s %s/", logfile, env.config.logDir())) | 184 » » fmt.Sprintf("ln -s %s %s/", logLocation, env.config.logDir())) |
| 185 |
181 if err := cloudinit.ConfigureJuju(mcfg, cloudcfg); err != nil { | 186 if err := cloudinit.ConfigureJuju(mcfg, cloudcfg); err != nil { |
182 return err | 187 return err |
183 } | 188 } |
184 return finishBootstrap(mcfg, cloudcfg, ctx) | 189 return finishBootstrap(mcfg, cloudcfg, ctx) |
185 } | 190 } |
186 | 191 |
187 // finishBootstrap converts the machine config to cloud-config, | 192 // finishBootstrap converts the machine config to cloud-config, |
188 // converts that to a script, and then executes it locally. | 193 // converts that to a script, and then executes it locally. |
189 // | 194 // |
190 // mcfg is supplied for testing purposes. | 195 // mcfg is supplied for testing purposes. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 438 |
434 // Ports is specified in the Environ interface. | 439 // Ports is specified in the Environ interface. |
435 func (env *localEnviron) Ports() ([]instance.Port, error) { | 440 func (env *localEnviron) Ports() ([]instance.Port, error) { |
436 return nil, nil | 441 return nil, nil |
437 } | 442 } |
438 | 443 |
439 // Provider is specified in the Environ interface. | 444 // Provider is specified in the Environ interface. |
440 func (env *localEnviron) Provider() environs.EnvironProvider { | 445 func (env *localEnviron) Provider() environs.EnvironProvider { |
441 return providerInstance | 446 return providerInstance |
442 } | 447 } |
LEFT | RIGHT |