Merge lp:~thumper/juju-core/no-proxy into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2399
Proposed branch: lp:~thumper/juju-core/no-proxy
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 549 lines (+140/-52)
10 files modified
environs/cloudinit/cloudinit_test.go (+7/-2)
environs/config/config.go (+22/-10)
environs/config/config_test.go (+17/-3)
juju/osenv/proxy.go (+14/-8)
juju/osenv/proxy_test.go (+38/-16)
provider/local/environprovider.go (+3/-1)
provider/local/environprovider_test.go (+21/-3)
worker/machineenvironmentworker/machineenvironmentworker_test.go (+4/-3)
worker/uniter/context_test.go (+7/-4)
worker/uniter/uniter_test.go (+7/-2)
To merge this branch: bzr merge lp:~thumper/juju-core/no-proxy
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+210098@code.launchpad.net

Commit message

Adds no_proxy support for proxies.

This was simply missed as part of the proxy support.
Tests updated throughout.

https://codereview.appspot.com/73290043/

Description of the change

Adds no_proxy support for proxies.

This was simply missed as part of the proxy support.
Tests updated throughout.

https://codereview.appspot.com/73290043/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+210098_code.launchpad.net,

Message:
Please take a look.

Description:
Adds no_proxy support for proxies.

This was simply missed as part of the proxy support.
Tests updated throughout.

https://code.launchpad.net/~thumper/juju-core/no-proxy/+merge/210098

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/73290043/

Affected files (+140, -50 lines):
   A [revision details]
   M environs/cloudinit/cloudinit_test.go
   M environs/config/config.go
   M environs/config/config_test.go
   M juju/osenv/proxy.go
   M juju/osenv/proxy_test.go
   M provider/local/environprovider.go
   M provider/local/environprovider_test.go
   M worker/machineenvironmentworker/machineenvironmentworker_test.go
   M worker/uniter/context_test.go
   M worker/uniter/uniter_test.go

Revision history for this message
Ian Booth (wallyworld) wrote :

LGTM so long as you are sure there are no backwards compatibility issues
with the config schema change

https://codereview.appspot.com/73290043/diff/1/environs/config/config.go
File environs/config/config.go (right):

https://codereview.appspot.com/73290043/diff/1/environs/config/config.go#newcode745
environs/config/config.go:745:
Config schema changes always scare me, especially since we've had back
backwards compatibility issues in the past eg for the simplestreams
change - are there tests required specifically for this change?

https://codereview.appspot.com/73290043/diff/1/juju/osenv/proxy.go
File juju/osenv/proxy.go (right):

https://codereview.appspot.com/73290043/diff/1/juju/osenv/proxy.go#newcode21
juju/osenv/proxy.go:21: // Detect Proxies.
Perhaps update the comment to mention NoProxy as it's quite important

https://codereview.appspot.com/73290043/

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (9.8 KiB)

The attempt to merge lp:~thumper/juju-core/no-proxy into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.013s
ok launchpad.net/juju-core/agent 1.089s
ok launchpad.net/juju-core/agent/mongo 0.512s
ok launchpad.net/juju-core/agent/tools 0.183s
ok launchpad.net/juju-core/bzr 5.502s
ok launchpad.net/juju-core/cert 3.061s
ok launchpad.net/juju-core/charm 0.447s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.027s
ok launchpad.net/juju-core/cloudinit/sshinit 0.967s
ok launchpad.net/juju-core/cmd 0.217s
ok launchpad.net/juju-core/cmd/charm-admin 0.810s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 200.228s
ok launchpad.net/juju-core/cmd/jujud 65.054s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 7.778s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/cmd/plugins/local 0.166s
? launchpad.net/juju-core/cmd/plugins/local/juju-local [no test files]
ok launchpad.net/juju-core/constraints 0.020s
ok launchpad.net/juju-core/container 0.038s
ok launchpad.net/juju-core/container/factory 0.045s
ok launchpad.net/juju-core/container/kvm 0.243s
ok launchpad.net/juju-core/container/kvm/mock 0.037s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 0.231s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.252s
ok launchpad.net/juju-core/environs 2.113s
ok launchpad.net/juju-core/environs/bootstrap 3.417s
ok launchpad.net/juju-core/environs/cloudinit 0.507s
ok launchpad.net/juju-core/environs/config 2.027s
ok launchpad.net/juju-core/environs/configstore 0.030s
ok launchpad.net/juju-core/environs/filestorage 0.025s
ok launchpad.net/juju-core/environs/httpstorage 0.747s
ok launchpad.net/juju-core/environs/imagemetadata 0.450s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.047s
ok launchpad.net/juju-core/environs/jujutest 0.192s
ok launchpad.net/juju-core/environs/manual 11.377s
ok launchpad.net/juju-core/environs/simplestreams 0.253s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.991s
ok launchpad.net/juju-core/environs/storage 0.884s
ok launchpad.net/juju-core/environs/sync 23.861s
ok launchpad.net/juju-core/environs/testing 0.154s
ok launchpad.net/juju-core/environs/tools 5.013s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.012s
ok launchpad.net/juju-core/instance 0.017s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 20.178s
ok launchpad.net/juju-core/juju/osenv 0.026s
? launchp...

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (9.4 KiB)

The attempt to merge lp:~thumper/juju-core/no-proxy into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.013s
ok launchpad.net/juju-core/agent 1.049s
ok launchpad.net/juju-core/agent/mongo 0.582s
ok launchpad.net/juju-core/agent/tools 0.168s
ok launchpad.net/juju-core/bzr 5.133s
ok launchpad.net/juju-core/cert 2.659s
ok launchpad.net/juju-core/charm 0.410s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.029s
ok launchpad.net/juju-core/cloudinit/sshinit 0.767s
ok launchpad.net/juju-core/cmd 0.213s
ok launchpad.net/juju-core/cmd/charm-admin 0.733s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 201.921s
ok launchpad.net/juju-core/cmd/jujud 63.907s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 7.291s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/cmd/plugins/local 0.138s
? launchpad.net/juju-core/cmd/plugins/local/juju-local [no test files]
ok launchpad.net/juju-core/constraints 0.019s
ok launchpad.net/juju-core/container 0.037s
ok launchpad.net/juju-core/container/factory 0.036s
ok launchpad.net/juju-core/container/kvm 0.203s
ok launchpad.net/juju-core/container/kvm/mock 0.047s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 0.208s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.208s
ok launchpad.net/juju-core/environs 2.485s
ok launchpad.net/juju-core/environs/bootstrap 3.398s
ok launchpad.net/juju-core/environs/cloudinit 0.452s
ok launchpad.net/juju-core/environs/config 2.247s
ok launchpad.net/juju-core/environs/configstore 0.030s
ok launchpad.net/juju-core/environs/filestorage 0.028s
ok launchpad.net/juju-core/environs/httpstorage 0.683s
ok launchpad.net/juju-core/environs/imagemetadata 0.428s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.042s
ok launchpad.net/juju-core/environs/jujutest 0.205s
ok launchpad.net/juju-core/environs/manual 10.114s
ok launchpad.net/juju-core/environs/simplestreams 0.253s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.792s
ok launchpad.net/juju-core/environs/storage 0.896s
ok launchpad.net/juju-core/environs/sync 24.924s
ok launchpad.net/juju-core/environs/testing 0.209s
ok launchpad.net/juju-core/environs/tools 5.158s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.012s
ok launchpad.net/juju-core/instance 0.018s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 19.969s
ok launchpad.net/juju-core/juju/osenv 0.016s
? launchp...

Read more...

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (9.8 KiB)

The attempt to merge lp:~thumper/juju-core/no-proxy into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.012s
ok launchpad.net/juju-core/agent 1.087s
ok launchpad.net/juju-core/agent/mongo 0.591s
ok launchpad.net/juju-core/agent/tools 0.155s
ok launchpad.net/juju-core/bzr 5.086s
ok launchpad.net/juju-core/cert 2.439s
ok launchpad.net/juju-core/charm 0.353s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.029s
ok launchpad.net/juju-core/cloudinit/sshinit 0.820s
ok launchpad.net/juju-core/cmd 0.168s
ok launchpad.net/juju-core/cmd/charm-admin 0.757s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 195.762s
ok launchpad.net/juju-core/cmd/jujud 62.266s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 7.311s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/cmd/plugins/local 0.173s
? launchpad.net/juju-core/cmd/plugins/local/juju-local [no test files]
ok launchpad.net/juju-core/constraints 0.024s
ok launchpad.net/juju-core/container 0.045s
ok launchpad.net/juju-core/container/factory 0.045s
ok launchpad.net/juju-core/container/kvm 0.170s
ok launchpad.net/juju-core/container/kvm/mock 0.050s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 0.211s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.262s
ok launchpad.net/juju-core/environs 2.436s
ok launchpad.net/juju-core/environs/bootstrap 3.182s
ok launchpad.net/juju-core/environs/cloudinit 0.407s
ok launchpad.net/juju-core/environs/config 2.396s
ok launchpad.net/juju-core/environs/configstore 0.029s
ok launchpad.net/juju-core/environs/filestorage 0.024s
ok launchpad.net/juju-core/environs/httpstorage 0.676s
ok launchpad.net/juju-core/environs/imagemetadata 0.443s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.048s
ok launchpad.net/juju-core/environs/jujutest 0.220s
ok launchpad.net/juju-core/environs/manual 9.752s
ok launchpad.net/juju-core/environs/simplestreams 0.263s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.857s
ok launchpad.net/juju-core/environs/storage 0.778s
ok launchpad.net/juju-core/environs/sync 25.163s
ok launchpad.net/juju-core/environs/testing 0.137s
ok launchpad.net/juju-core/environs/tools 4.756s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.011s
ok launchpad.net/juju-core/instance 0.019s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 19.785s
ok launchpad.net/juju-core/juju/osenv 0.016s
? launchpa...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/cloudinit/cloudinit_test.go'
2--- environs/cloudinit/cloudinit_test.go 2014-03-07 10:53:01 +0000
3+++ environs/cloudinit/cloudinit_test.go 2014-03-10 07:21:23 +0000
4@@ -835,6 +835,7 @@
5 environConfig := minimalConfig(c)
6 environConfig, err := environConfig.Apply(map[string]interface{}{
7 "http-proxy": "http://user@10.0.0.1",
8+ "no-proxy": "localhost,10.0.3.1",
9 })
10 c.Assert(err, gc.IsNil)
11 machineCfg := s.createMachineConfig(c, environConfig)
12@@ -847,13 +848,17 @@
13 expected := []interface{}{
14 `export http_proxy=http://user@10.0.0.1`,
15 `export HTTP_PROXY=http://user@10.0.0.1`,
16+ `export no_proxy=localhost,10.0.3.1`,
17+ `export NO_PROXY=localhost,10.0.3.1`,
18 `[ -e /home/ubuntu ] && (printf '%s\n' 'export http_proxy=http://user@10.0.0.1
19-export HTTP_PROXY=http://user@10.0.0.1' > /home/ubuntu/.juju-proxy && chown ubuntu:ubuntu /home/ubuntu/.juju-proxy)`,
20+export HTTP_PROXY=http://user@10.0.0.1
21+export no_proxy=localhost,10.0.3.1
22+export NO_PROXY=localhost,10.0.3.1' > /home/ubuntu/.juju-proxy && chown ubuntu:ubuntu /home/ubuntu/.juju-proxy)`,
23 }
24 found := false
25 for i, cmd := range cmds {
26 if cmd == first {
27- c.Assert(cmds[i+1:i+4], jc.DeepEquals, expected)
28+ c.Assert(cmds[i+1:i+6], jc.DeepEquals, expected)
29 found = true
30 break
31 }
32
33=== modified file 'environs/config/config.go'
34--- environs/config/config.go 2014-03-07 14:15:28 +0000
35+++ environs/config/config.go 2014-03-10 07:21:23 +0000
36@@ -442,12 +442,14 @@
37 return c.mustString("authorized-keys")
38 }
39
40-// ProxySettings returns all three proxy settings; http, https and ftp.
41+// ProxySettings returns all four proxy settings; http, https, ftp, and no
42+// proxy.
43 func (c *Config) ProxySettings() osenv.ProxySettings {
44 return osenv.ProxySettings{
45- Http: c.HttpProxy(),
46- Https: c.HttpsProxy(),
47- Ftp: c.FtpProxy(),
48+ Http: c.HttpProxy(),
49+ Https: c.HttpsProxy(),
50+ Ftp: c.FtpProxy(),
51+ NoProxy: c.NoProxy(),
52 }
53 }
54
55@@ -466,6 +468,11 @@
56 return c.asString("ftp-proxy")
57 }
58
59+// NoProxy returns the 'no proxy' for the environment.
60+func (c *Config) NoProxy() string {
61+ return c.asString("no-proxy")
62+}
63+
64 func (c *Config) getWithFallback(key, fallback string) string {
65 value := c.asString(key)
66 if value == "" {
67@@ -692,6 +699,7 @@
68 "http-proxy": schema.String(),
69 "https-proxy": schema.String(),
70 "ftp-proxy": schema.String(),
71+ "no-proxy": schema.String(),
72 "apt-http-proxy": schema.String(),
73 "apt-https-proxy": schema.String(),
74 "apt-ftp-proxy": schema.String(),
75@@ -721,17 +729,20 @@
76 "ca-private-key-path": schema.Omit,
77 "logging-config": schema.Omit,
78 "provisioner-safe-mode": schema.Omit,
79- "http-proxy": schema.Omit,
80- "https-proxy": schema.Omit,
81- "ftp-proxy": schema.Omit,
82- "apt-http-proxy": schema.Omit,
83- "apt-https-proxy": schema.Omit,
84- "apt-ftp-proxy": schema.Omit,
85 "bootstrap-timeout": schema.Omit,
86 "bootstrap-retry-delay": schema.Omit,
87 "bootstrap-addresses-delay": schema.Omit,
88 "rsyslog-ca-cert": schema.Omit,
89
90+ // Proxy values default to "", otherwise they can't be set to blank.
91+ "http-proxy": "",
92+ "https-proxy": "",
93+ "ftp-proxy": "",
94+ "no-proxy": "",
95+ "apt-http-proxy": "",
96+ "apt-https-proxy": "",
97+ "apt-ftp-proxy": "",
98+
99 // Deprecated fields, retain for backwards compatibility.
100 "tools-url": "",
101
102@@ -907,6 +918,7 @@
103 "http-proxy": proxy.Http,
104 "https-proxy": proxy.Https,
105 "ftp-proxy": proxy.Ftp,
106+ "no-proxy": proxy.NoProxy,
107 }
108 }
109
110
111=== modified file 'environs/config/config_test.go'
112--- environs/config/config_test.go 2014-03-07 14:15:28 +0000
113+++ environs/config/config_test.go 2014-03-10 07:21:23 +0000
114@@ -1026,6 +1026,14 @@
115 attrs["tools-metadata-url"] = ""
116 attrs["tools-url"] = ""
117 attrs["image-stream"] = ""
118+ attrs["http-proxy"] = ""
119+ attrs["https-proxy"] = ""
120+ attrs["ftp-proxy"] = ""
121+ attrs["no-proxy"] = ""
122+ attrs["apt-http-proxy"] = ""
123+ attrs["apt-https-proxy"] = ""
124+ attrs["apt-ftp-proxy"] = ""
125+
126 // Default firewall mode is instance
127 attrs["firewall-mode"] = string(config.FwInstance)
128 c.Assert(cfg.AllAttrs(), jc.DeepEquals, attrs)
129@@ -1221,6 +1229,7 @@
130 "http-proxy": "http://user@10.0.0.1",
131 "https-proxy": "https://user@10.0.0.1",
132 "ftp-proxy": "ftp://user@10.0.0.1",
133+ "no-proxy": "localhost,10.0.3.1",
134 })
135 c.Assert(config.HttpProxy(), gc.Equals, "http://user@10.0.0.1")
136 c.Assert(config.AptHttpProxy(), gc.Equals, "http://user@10.0.0.1")
137@@ -1228,6 +1237,7 @@
138 c.Assert(config.AptHttpsProxy(), gc.Equals, "https://user@10.0.0.1")
139 c.Assert(config.FtpProxy(), gc.Equals, "ftp://user@10.0.0.1")
140 c.Assert(config.AptFtpProxy(), gc.Equals, "ftp://user@10.0.0.1")
141+ c.Assert(config.NoProxy(), gc.Equals, "localhost,10.0.3.1")
142 }
143
144 func (*ConfigSuite) TestProxyValues(c *gc.C) {
145@@ -1259,6 +1269,7 @@
146 c.Assert(config.AptHttpsProxy(), gc.Equals, "")
147 c.Assert(config.FtpProxy(), gc.Equals, "")
148 c.Assert(config.AptFtpProxy(), gc.Equals, "")
149+ c.Assert(config.NoProxy(), gc.Equals, "")
150 }
151
152 func (*ConfigSuite) TestProxyConfigMap(c *gc.C) {
153@@ -1266,13 +1277,16 @@
154
155 cfg := newTestConfig(c, testing.Attrs{})
156 proxy := osenv.ProxySettings{
157- Http: "http proxy",
158- Https: "https proxy",
159- Ftp: "ftp proxy",
160+ Http: "http proxy",
161+ Https: "https proxy",
162+ Ftp: "ftp proxy",
163+ NoProxy: "no proxy",
164 }
165 cfg, err := cfg.Apply(config.ProxyConfigMap(proxy))
166 c.Assert(err, gc.IsNil)
167 c.Assert(cfg.ProxySettings(), gc.DeepEquals, proxy)
168+ // Apt proxy and proxy differ by the content of the no-proxy values.
169+ proxy.NoProxy = ""
170 c.Assert(cfg.AptProxySettings(), gc.DeepEquals, proxy)
171 }
172
173
174=== modified file 'juju/osenv/proxy.go'
175--- juju/osenv/proxy.go 2014-01-28 03:53:50 +0000
176+++ juju/osenv/proxy.go 2014-03-10 07:21:23 +0000
177@@ -14,14 +14,16 @@
178 http_proxy = "http_proxy"
179 https_proxy = "https_proxy"
180 ftp_proxy = "ftp_proxy"
181+ no_proxy = "no_proxy"
182 )
183
184-// ProxySettings holds the values for the http, https and ftp proxies found by
185-// Detect Proxies.
186+// ProxySettings holds the values for the http, https and ftp proxies as well
187+// as the no_proxy value found by Detect Proxies.
188 type ProxySettings struct {
189- Http string
190- Https string
191- Ftp string
192+ Http string
193+ Https string
194+ Ftp string
195+ NoProxy string
196 }
197
198 func getProxySetting(key string) string {
199@@ -35,9 +37,10 @@
200 // DetectProxies returns the proxy settings found the environment.
201 func DetectProxies() ProxySettings {
202 return ProxySettings{
203- Http: getProxySetting(http_proxy),
204- Https: getProxySetting(https_proxy),
205- Ftp: getProxySetting(ftp_proxy),
206+ Http: getProxySetting(http_proxy),
207+ Https: getProxySetting(https_proxy),
208+ Ftp: getProxySetting(ftp_proxy),
209+ NoProxy: getProxySetting(no_proxy),
210 }
211 }
212
213@@ -57,6 +60,7 @@
214 addLine(http_proxy, s.Http)
215 addLine(https_proxy, s.Https)
216 addLine(ftp_proxy, s.Ftp)
217+ addLine(no_proxy, s.NoProxy)
218 return strings.Join(lines, "\n")
219 }
220
221@@ -76,6 +80,7 @@
222 addLine(http_proxy, s.Http)
223 addLine(https_proxy, s.Https)
224 addLine(ftp_proxy, s.Ftp)
225+ addLine(no_proxy, s.NoProxy)
226 return lines
227 }
228
229@@ -94,4 +99,5 @@
230 setenv(http_proxy, s.Http)
231 setenv(https_proxy, s.Https)
232 setenv(ftp_proxy, s.Ftp)
233+ setenv(no_proxy, s.NoProxy)
234 }
235
236=== modified file 'juju/osenv/proxy_test.go'
237--- juju/osenv/proxy_test.go 2014-01-28 03:53:50 +0000
238+++ juju/osenv/proxy_test.go 2014-03-10 07:21:23 +0000
239@@ -27,6 +27,8 @@
240 s.PatchEnvironment("HTTPS_PROXY", "")
241 s.PatchEnvironment("ftp_proxy", "")
242 s.PatchEnvironment("FTP_PROXY", "")
243+ s.PatchEnvironment("no_proxy", "")
244+ s.PatchEnvironment("NO_PROXY", "")
245
246 proxies := osenv.DetectProxies()
247
248@@ -42,13 +44,16 @@
249 s.PatchEnvironment("HTTPS_PROXY", "")
250 s.PatchEnvironment("ftp_proxy", "ftp://user@10.0.0.1")
251 s.PatchEnvironment("FTP_PROXY", "")
252+ s.PatchEnvironment("no_proxy", "10.0.3.1,localhost")
253+ s.PatchEnvironment("NO_PROXY", "")
254
255 proxies := osenv.DetectProxies()
256
257 c.Assert(proxies, gc.DeepEquals, osenv.ProxySettings{
258- Http: "http://user@10.0.0.1",
259- Https: "https://user@10.0.0.1",
260- Ftp: "ftp://user@10.0.0.1",
261+ Http: "http://user@10.0.0.1",
262+ Https: "https://user@10.0.0.1",
263+ Ftp: "ftp://user@10.0.0.1",
264+ NoProxy: "10.0.3.1,localhost",
265 })
266 }
267
268@@ -61,13 +66,16 @@
269 s.PatchEnvironment("HTTPS_PROXY", "https://user@10.0.0.2")
270 s.PatchEnvironment("ftp_proxy", "")
271 s.PatchEnvironment("FTP_PROXY", "ftp://user@10.0.0.2")
272+ s.PatchEnvironment("no_proxy", "")
273+ s.PatchEnvironment("NO_PROXY", "10.0.3.1,localhost")
274
275 proxies := osenv.DetectProxies()
276
277 c.Assert(proxies, gc.DeepEquals, osenv.ProxySettings{
278- Http: "http://user@10.0.0.2",
279- Https: "https://user@10.0.0.2",
280- Ftp: "ftp://user@10.0.0.2",
281+ Http: "http://user@10.0.0.2",
282+ Https: "https://user@10.0.0.2",
283+ Ftp: "ftp://user@10.0.0.2",
284+ NoProxy: "10.0.3.1,localhost",
285 })
286 }
287
288@@ -77,16 +85,19 @@
289 s.PatchEnvironment("http_proxy", "http://user@10.0.0.1")
290 s.PatchEnvironment("https_proxy", "https://user@10.0.0.1")
291 s.PatchEnvironment("ftp_proxy", "ftp://user@10.0.0.1")
292+ s.PatchEnvironment("no_proxy", "10.0.3.1,localhost")
293 s.PatchEnvironment("HTTP_PROXY", "http://user@10.0.0.2")
294 s.PatchEnvironment("HTTPS_PROXY", "https://user@10.0.0.2")
295 s.PatchEnvironment("FTP_PROXY", "ftp://user@10.0.0.2")
296+ s.PatchEnvironment("NO_PROXY", "localhost")
297
298 proxies := osenv.DetectProxies()
299
300 c.Assert(proxies, gc.DeepEquals, osenv.ProxySettings{
301- Http: "http://user@10.0.0.1",
302- Https: "https://user@10.0.0.1",
303- Ftp: "ftp://user@10.0.0.1",
304+ Http: "http://user@10.0.0.1",
305+ Https: "https://user@10.0.0.1",
306+ Ftp: "ftp://user@10.0.0.1",
307+ NoProxy: "10.0.3.1,localhost",
308 })
309 }
310
311@@ -107,9 +118,10 @@
312
313 func (s *proxySuite) TestAsScriptEnvironmentAllValue(c *gc.C) {
314 proxies := osenv.ProxySettings{
315- Http: "some-value",
316- Https: "special",
317- Ftp: "who uses this?",
318+ Http: "some-value",
319+ Https: "special",
320+ Ftp: "who uses this?",
321+ NoProxy: "10.0.3.1,localhost",
322 }
323 expected := `
324 export http_proxy=some-value
325@@ -117,7 +129,9 @@
326 export https_proxy=special
327 export HTTPS_PROXY=special
328 export ftp_proxy=who uses this?
329-export FTP_PROXY=who uses this?`[1:]
330+export FTP_PROXY=who uses this?
331+export no_proxy=10.0.3.1,localhost
332+export NO_PROXY=10.0.3.1,localhost`[1:]
333 c.Assert(proxies.AsScriptEnvironment(), gc.Equals, expected)
334 }
335
336@@ -139,9 +153,10 @@
337
338 func (s *proxySuite) TestAsEnvironmentValuesAllValue(c *gc.C) {
339 proxies := osenv.ProxySettings{
340- Http: "some-value",
341- Https: "special",
342- Ftp: "who uses this?",
343+ Http: "some-value",
344+ Https: "special",
345+ Ftp: "who uses this?",
346+ NoProxy: "10.0.3.1,localhost",
347 }
348 expected := []string{
349 "http_proxy=some-value",
350@@ -150,6 +165,8 @@
351 "HTTPS_PROXY=special",
352 "ftp_proxy=who uses this?",
353 "FTP_PROXY=who uses this?",
354+ "no_proxy=10.0.3.1,localhost",
355+ "NO_PROXY=10.0.3.1,localhost",
356 }
357 c.Assert(proxies.AsEnvironmentValues(), gc.DeepEquals, expected)
358 }
359@@ -161,11 +178,14 @@
360 s.PatchEnvironment("HTTPS_PROXY", "initial")
361 s.PatchEnvironment("ftp_proxy", "initial")
362 s.PatchEnvironment("FTP_PROXY", "initial")
363+ s.PatchEnvironment("no_proxy", "initial")
364+ s.PatchEnvironment("NO_PROXY", "initial")
365
366 proxy := osenv.ProxySettings{
367 Http: "http proxy",
368 Https: "https proxy",
369 // Ftp left blank to show clearing env.
370+ NoProxy: "10.0.3.1,localhost",
371 }
372 proxy.SetEnvironmentValues()
373
374@@ -179,4 +199,6 @@
375 c.Assert(os.Getenv("HTTPS_PROXY"), gc.Equals, "https proxy")
376 c.Assert(os.Getenv("ftp_proxy"), gc.Equals, "")
377 c.Assert(os.Getenv("FTP_PROXY"), gc.Equals, "")
378+ c.Assert(os.Getenv("no_proxy"), gc.Equals, "10.0.3.1,localhost")
379+ c.Assert(os.Getenv("NO_PROXY"), gc.Equals, "10.0.3.1,localhost")
380 }
381
382=== modified file 'provider/local/environprovider.go'
383--- provider/local/environprovider.go 2014-03-05 19:41:34 +0000
384+++ provider/local/environprovider.go 2014-03-10 07:21:23 +0000
385@@ -112,12 +112,14 @@
386 logger.Tracef("Look for proxies?")
387 if cfg.HttpProxy() == "" &&
388 cfg.HttpsProxy() == "" &&
389- cfg.FtpProxy() == "" {
390+ cfg.FtpProxy() == "" &&
391+ cfg.NoProxy() == "" {
392 proxy := osenv.DetectProxies()
393 logger.Tracef("Proxies detected %#v", proxy)
394 setIfNotBlank("http-proxy", proxy.Http)
395 setIfNotBlank("https-proxy", proxy.Https)
396 setIfNotBlank("ftp-proxy", proxy.Ftp)
397+ setIfNotBlank("no-proxy", proxy.NoProxy)
398 }
399 if cfg.AptHttpProxy() == "" &&
400 cfg.AptHttpsProxy() == "" &&
401
402=== modified file 'provider/local/environprovider_test.go'
403--- provider/local/environprovider_test.go 2014-03-05 19:41:34 +0000
404+++ provider/local/environprovider_test.go 2014-03-10 07:21:23 +0000
405@@ -55,6 +55,8 @@
406 s.PatchEnvironment("HTTPS_PROXY", "")
407 s.PatchEnvironment("ftp_proxy", "")
408 s.PatchEnvironment("FTP_PROXY", "")
409+ s.PatchEnvironment("no_proxy", "")
410+ s.PatchEnvironment("NO_PROXY", "")
411 s.HookCommandOutput(&utils.AptCommandOutput, nil, nil)
412 s.PatchValue(local.CheckLocalPort, func(port int, desc string) error {
413 return nil
414@@ -87,11 +89,13 @@
415 "http_proxy": "http://user@10.0.0.1",
416 "HTTPS_PROXY": "https://user@10.0.0.1",
417 "ftp_proxy": "ftp://user@10.0.0.1",
418+ "no_proxy": "localhost,10.0.3.1",
419 },
420 expectedProxy: osenv.ProxySettings{
421- Http: "http://user@10.0.0.1",
422- Https: "https://user@10.0.0.1",
423- Ftp: "ftp://user@10.0.0.1",
424+ Http: "http://user@10.0.0.1",
425+ Https: "https://user@10.0.0.1",
426+ Ftp: "ftp://user@10.0.0.1",
427+ NoProxy: "localhost,10.0.3.1",
428 },
429 expectedAptProxy: osenv.ProxySettings{
430 Http: "http://user@10.0.0.1",
431@@ -147,6 +151,19 @@
432 Ftp: "ftp://user@10.0.0.42",
433 },
434 }, {
435+ message: "skips proxy from environment if no-proxy set",
436+ extraConfig: map[string]interface{}{
437+ "no-proxy": "localhost,10.0.3.1",
438+ },
439+ env: map[string]string{
440+ "http_proxy": "http://user@10.0.0.1",
441+ "HTTPS_PROXY": "https://user@10.0.0.1",
442+ "ftp_proxy": "ftp://user@10.0.0.1",
443+ },
444+ expectedProxy: osenv.ProxySettings{
445+ NoProxy: "localhost,10.0.3.1",
446+ },
447+ }, {
448 message: "apt-proxies detected",
449 aptOutput: `CommandLine::AsString "apt-config dump";
450 Acquire::http::Proxy "10.0.3.1:3142";
451@@ -222,6 +239,7 @@
452 c.Assert(envConfig.HttpProxy(), gc.Equals, test.expectedProxy.Http)
453 c.Assert(envConfig.HttpsProxy(), gc.Equals, test.expectedProxy.Https)
454 c.Assert(envConfig.FtpProxy(), gc.Equals, test.expectedProxy.Ftp)
455+ c.Assert(envConfig.NoProxy(), gc.Equals, test.expectedProxy.NoProxy)
456
457 c.Assert(envConfig.AptHttpProxy(), gc.Equals, test.expectedAptProxy.Http)
458 c.Assert(envConfig.AptHttpsProxy(), gc.Equals, test.expectedAptProxy.Https)
459
460=== modified file 'worker/machineenvironmentworker/machineenvironmentworker_test.go'
461--- worker/machineenvironmentworker/machineenvironmentworker_test.go 2014-02-12 21:12:31 +0000
462+++ worker/machineenvironmentworker/machineenvironmentworker_test.go 2014-03-10 07:21:23 +0000
463@@ -123,9 +123,10 @@
464 c.Assert(err, gc.IsNil)
465
466 proxySettings := osenv.ProxySettings{
467- Http: "http proxy",
468- Https: "https proxy",
469- Ftp: "ftp proxy",
470+ Http: "http proxy",
471+ Https: "https proxy",
472+ Ftp: "ftp proxy",
473+ NoProxy: "no proxy",
474 }
475
476 envConfig, err := oldConfig.Apply(config.ProxyConfigMap(proxySettings))
477
478=== modified file 'worker/uniter/context_test.go'
479--- worker/uniter/context_test.go 2014-02-13 16:32:00 +0000
480+++ worker/uniter/context_test.go 2014-03-10 07:21:23 +0000
481@@ -174,10 +174,11 @@
482 stdout: strings.Repeat("a", lineBufferSize+10),
483 },
484 }, {
485- summary: "check shell environment for non-relation hook context",
486- relid: -1,
487- spec: hookSpec{perm: 0700},
488- proxySettings: osenv.ProxySettings{Http: "http", Https: "https", Ftp: "ftp"},
489+ summary: "check shell environment for non-relation hook context",
490+ relid: -1,
491+ spec: hookSpec{perm: 0700},
492+ proxySettings: osenv.ProxySettings{
493+ Http: "http", Https: "https", Ftp: "ftp", NoProxy: "no proxy"},
494 env: map[string]string{
495 "JUJU_UNIT_NAME": "u/0",
496 "JUJU_API_ADDRESSES": expectedApiAddrs,
497@@ -188,6 +189,8 @@
498 "HTTPS_PROXY": "https",
499 "ftp_proxy": "ftp",
500 "FTP_PROXY": "ftp",
501+ "no_proxy": "no proxy",
502+ "NO_PROXY": "no proxy",
503 },
504 }, {
505 summary: "check shell environment for relation-broken hook context",
506
507=== modified file 'worker/uniter/uniter_test.go'
508--- worker/uniter/uniter_test.go 2014-03-05 14:03:02 +0000
509+++ worker/uniter/uniter_test.go 2014-03-10 07:21:23 +0000
510@@ -873,7 +873,7 @@
511 ), ut(
512 "run commands: proxy settings set",
513 quickStartRelation{},
514- setProxySettings{Http: "http", Https: "https", Ftp: "ftp"},
515+ setProxySettings{Http: "http", Https: "https", Ftp: "ftp", NoProxy: "localhost"},
516 runCommands{
517 fmt.Sprintf("echo $http_proxy > %s", testFile("proxy.output")),
518 fmt.Sprintf("echo $HTTP_PROXY >> %s", testFile("proxy.output")),
519@@ -881,10 +881,12 @@
520 fmt.Sprintf("echo $HTTPS_PROXY >> %s", testFile("proxy.output")),
521 fmt.Sprintf("echo $ftp_proxy >> %s", testFile("proxy.output")),
522 fmt.Sprintf("echo $FTP_PROXY >> %s", testFile("proxy.output")),
523+ fmt.Sprintf("echo $no_proxy >> %s", testFile("proxy.output")),
524+ fmt.Sprintf("echo $NO_PROXY >> %s", testFile("proxy.output")),
525 },
526 verifyFile{
527 testFile("proxy.output"),
528- "http\nhttp\nhttps\nhttps\nftp\nftp\n",
529+ "http\nhttp\nhttps\nhttps\nftp\nftp\nlocalhost\nlocalhost\n",
530 },
531 ), ut(
532 "run commands: async using rpc client",
533@@ -1963,6 +1965,7 @@
534 "http-proxy": s.Http,
535 "https-proxy": s.Https,
536 "ftp-proxy": s.Ftp,
537+ "no-proxy": s.NoProxy,
538 })
539 c.Assert(err, gc.IsNil)
540 err = ctx.st.SetEnvironConfig(cfg, old)
541@@ -1978,6 +1981,8 @@
542 c.Assert(os.Getenv("HTTPS_PROXY"), gc.Equals, expected.Https)
543 c.Assert(os.Getenv("ftp_proxy"), gc.Equals, expected.Ftp)
544 c.Assert(os.Getenv("FTP_PROXY"), gc.Equals, expected.Ftp)
545+ c.Assert(os.Getenv("no_proxy"), gc.Equals, expected.NoProxy)
546+ c.Assert(os.Getenv("NO_PROXY"), gc.Equals, expected.NoProxy)
547 return
548 }
549 }

Subscribers

People subscribed via source and target branches

to status/vote changes: