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
diff --git a/src/maasserver/bootsources.py b/src/maasserver/bootsources.py
index 999a6d8..6ad2bf7 100644
--- a/src/maasserver/bootsources.py
+++ b/src/maasserver/bootsources.py
@@ -87,6 +87,11 @@ def get_simplestreams_env():
87 if http_proxy is not None:87 if http_proxy is not None:
88 env['http_proxy'] = http_proxy88 env['http_proxy'] = http_proxy
89 env['https_proxy'] = http_proxy89 env['https_proxy'] = http_proxy
90 # When the proxy environment variables are set they effect the
91 # entire process, including controller refresh. When the region
92 # needs to refresh itself it sends itself results over HTTP to
93 # 127.0.0.1.
94 env['no_proxy'] = '127.0.0.1,localhost'
90 return env95 return env
9196
9297
diff --git a/src/maasserver/tests/test_bootsources.py b/src/maasserver/tests/test_bootsources.py
index ecba7ce..66b0b96 100644
--- a/src/maasserver/tests/test_bootsources.py
+++ b/src/maasserver/tests/test_bootsources.py
@@ -253,8 +253,10 @@ class TestPrivateCacheBootSources(MAASTransactionServerTestCase):
253 factory.make_BootSource(keyring_data=b'1234')253 factory.make_BootSource(keyring_data=b'1234')
254 cache_boot_sources()254 cache_boot_sources()
255 self.assertEqual(255 self.assertEqual(
256 (proxy_address, proxy_address),256 (proxy_address, proxy_address, '127.0.0.1,localhost'),
257 (capture.env['http_proxy'], capture.env['https_proxy']))257 (
258 capture.env['http_proxy'], capture.env['https_proxy'],
259 capture.env['no_proxy']))
258260
259 def test__passes_user_agent_with_maas_version(self):261 def test__passes_user_agent_with_maas_version(self):
260 mock_download = self.patch(262 mock_download = self.patch(

Subscribers

People subscribed via source and target branches