OLD | NEW |
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 package local | 3 package local |
4 | 4 |
5 import ( | 5 import ( |
6 "github.com/juju/testing" | 6 "github.com/juju/testing" |
7 gc "launchpad.net/gocheck" | 7 gc "launchpad.net/gocheck" |
8 | 8 |
9 "launchpad.net/juju-core/environs/config" | 9 "launchpad.net/juju-core/environs/config" |
10 ) | 10 ) |
11 | 11 |
12 var ( | 12 var ( |
13 CheckIfRoot = &checkIfRoot | 13 CheckIfRoot = &checkIfRoot |
14 CheckLocalPort = &checkLocalPort | 14 CheckLocalPort = &checkLocalPort |
15 DetectAptProxies = &detectAptProxies | 15 DetectAptProxies = &detectAptProxies |
16 FinishBootstrap = &finishBootstrap | 16 FinishBootstrap = &finishBootstrap |
17 Provider = providerInstance | 17 Provider = providerInstance |
18 ReleaseVersion = &releaseVersion | |
19 UseFastLXC = useFastLXC | |
20 UserCurrent = &userCurrent | 18 UserCurrent = &userCurrent |
21 ) | 19 ) |
22 | 20 |
23 // ConfigNamespace returns the result of the namespace call on the | 21 // ConfigNamespace returns the result of the namespace call on the |
24 // localConfig. | 22 // localConfig. |
25 func ConfigNamespace(cfg *config.Config) string { | 23 func ConfigNamespace(cfg *config.Config) string { |
26 env, _ := providerInstance.Open(cfg) | 24 env, _ := providerInstance.Open(cfg) |
27 return env.(*localEnviron).config.namespace() | 25 return env.(*localEnviron).config.namespace() |
28 } | 26 } |
29 | 27 |
(...skipping 16 matching lines...) Expand all Loading... |
46 } | 44 } |
47 | 45 |
48 // MockAddressForInterface replaces the getAddressForInterface with a function | 46 // MockAddressForInterface replaces the getAddressForInterface with a function |
49 // that returns a constant localhost ip address. | 47 // that returns a constant localhost ip address. |
50 func MockAddressForInterface() func() { | 48 func MockAddressForInterface() func() { |
51 return testing.PatchValue(&getAddressForInterface, func(name string) (st
ring, error) { | 49 return testing.PatchValue(&getAddressForInterface, func(name string) (st
ring, error) { |
52 logger.Debugf("getAddressForInterface called for %s", name) | 50 logger.Debugf("getAddressForInterface called for %s", name) |
53 return "127.0.0.1", nil | 51 return "127.0.0.1", nil |
54 }) | 52 }) |
55 } | 53 } |
OLD | NEW |