Merge ~ltrager/maas:lp1705508_2.2 into maas:2.2

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: bc7eba5f5fc17427ff31c9f58cb750fe789e497b
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ltrager/maas:lp1705508_2.2
Merge into: maas:2.2
Diff against target: 33 lines (+9/-2)
2 files modified
src/maasserver/bootsources.py (+5/-0)
src/maasserver/tests/test_bootsources.py (+4/-2)
Reviewer Review Type Date Requested Status
Lee Trager (community) Approve
Review via email: mp+328152@code.launchpad.net

Commit message

Set the no_proxy environment variable to 127.0.0.1,localhost.

When MAAS starts importing boot resources it sets the proxy environment
variables for the whole process, if an external proxy is set. No exceptions were made for 127.0.0.1 or localhost. Region refresh sends results to itself over HTTP. Because no exceptions were allowed region refresh failed.

Fixes: LP: #1705508
Backport: 027666bfbc56fbd52ebcd40ac0d9e71a9d4cc41e

To post a comment you must log in.
Revision history for this message
Lee Trager (ltrager) wrote :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/bootsources.py b/src/maasserver/bootsources.py
2index 999a6d8..6ad2bf7 100644
3--- a/src/maasserver/bootsources.py
4+++ b/src/maasserver/bootsources.py
5@@ -87,6 +87,11 @@ def get_simplestreams_env():
6 if http_proxy is not None:
7 env['http_proxy'] = http_proxy
8 env['https_proxy'] = http_proxy
9+ # When the proxy environment variables are set they effect the
10+ # entire process, including controller refresh. When the region
11+ # needs to refresh itself it sends itself results over HTTP to
12+ # 127.0.0.1.
13+ env['no_proxy'] = '127.0.0.1,localhost'
14 return env
15
16
17diff --git a/src/maasserver/tests/test_bootsources.py b/src/maasserver/tests/test_bootsources.py
18index ecba7ce..66b0b96 100644
19--- a/src/maasserver/tests/test_bootsources.py
20+++ b/src/maasserver/tests/test_bootsources.py
21@@ -253,8 +253,10 @@ class TestPrivateCacheBootSources(MAASTransactionServerTestCase):
22 factory.make_BootSource(keyring_data=b'1234')
23 cache_boot_sources()
24 self.assertEqual(
25- (proxy_address, proxy_address),
26- (capture.env['http_proxy'], capture.env['https_proxy']))
27+ (proxy_address, proxy_address, '127.0.0.1,localhost'),
28+ (
29+ capture.env['http_proxy'], capture.env['https_proxy'],
30+ capture.env['no_proxy']))
31
32 def test__passes_user_agent_with_maas_version(self):
33 mock_download = self.patch(

Subscribers

People subscribed via source and target branches