launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #13621
[Merge] lp:~allenap/maas/proxy-settings into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/proxy-settings into lp:maas.
Commit message:
Add an http_proxy configuration setting, and allow it to be edited from the settings page.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1068843 in MAAS: "maas-cluster-controller doesn't have images for provisioning"
https://bugs.launchpad.net/maas/+bug/1068843
For more details, see:
https://code.launchpad.net/~allenap/maas/proxy-settings/+merge/130966
--
https://code.launchpad.net/~allenap/maas/proxy-settings/+merge/130966
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/proxy-settings into lp:maas.
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2012-10-04 13:00:54 +0000
+++ src/maasserver/forms.py 2012-10-23 09:49:34 +0000
@@ -569,6 +569,12 @@
label="Default domain for new nodes", required=False, help_text=(
"If 'local' is chosen, nodes must be using mDNS. Leave empty to "
"use hostnames without a domain for newly enlisted nodes."))
+ http_proxy = forms.URLField(
+ label="Proxy for HTTP and HTTPS traffic", required=False,
+ help_text=(
+ "This is used by the cluster and region controllers, for "
+ "downloading PXE boot images and other provisioning-related "
+ "resources. It is not passed into provisioned nodes."))
class CommissioningForm(ConfigForm):
=== modified file 'src/maasserver/models/config.py'
--- src/maasserver/models/config.py 2012-09-27 13:50:34 +0000
+++ src/maasserver/models/config.py 2012-10-23 09:49:34 +0000
@@ -53,6 +53,7 @@
'enlistment_domain': b'local',
'default_distro_series': DISTRO_SERIES.precise,
'commissioning_distro_series': DISTRO_SERIES.precise,
+ 'http_proxy': None,
## /settings
}
=== modified file 'src/maasserver/tests/test_config.py'
--- src/maasserver/tests/test_config.py 2012-05-11 07:51:59 +0000
+++ src/maasserver/tests/test_config.py 2012-10-23 09:49:34 +0000
@@ -16,10 +16,8 @@
from fixtures import TestWithFixtures
from maasserver.models import Config
-from maasserver.models.config import (
- DEFAULT_CONFIG,
- get_default_config,
- )
+import maasserver.models.config
+from maasserver.models.config import get_default_config
from maasserver.testing.factory import factory
from maasserver.testing.testcase import TestCase
@@ -31,6 +29,14 @@
default_config = get_default_config()
self.assertEqual(gethostname(), default_config['maas_name'])
+ def test_defaults(self):
+ expected = get_default_config()
+ observed = {
+ name: Config.objects.get_config(name)
+ for name in expected
+ }
+ self.assertEqual(expected, observed)
+
class CallRecorder:
"""A utility class which tracks the calls to its 'call' method and
@@ -63,13 +69,15 @@
def test_manager_get_config_not_found_in_default_config(self):
name = factory.getRandomString()
value = factory.getRandomString()
- DEFAULT_CONFIG[name] = value
+ self.patch(maasserver.models.config, "DEFAULT_CONFIG", {name: value})
config = Config.objects.get_config(name, None)
self.assertEqual(value, config)
def test_default_config_cannot_be_changed(self):
name = factory.getRandomString()
- DEFAULT_CONFIG[name] = {'key': 'value'}
+ self.patch(
+ maasserver.models.config, "DEFAULT_CONFIG",
+ {name: {'key': 'value'}})
config = Config.objects.get_config(name)
config.update({'key2': 'value2'})
=== modified file 'src/maasserver/tests/test_views_settings.py'
--- src/maasserver/tests/test_views_settings.py 2012-10-03 15:48:11 +0000
+++ src/maasserver/tests/test_views_settings.py 2012-10-23 09:49:34 +0000
@@ -82,6 +82,7 @@
self.patch(settings, "DNS_CONNECT", False)
new_name = factory.getRandomString()
new_domain = factory.getRandomString()
+ new_proxy = "http://%s.example.com:1234/" % factory.getRandomString()
response = self.client.post(
reverse('settings'),
get_prefixed_form_data(
@@ -89,12 +90,13 @@
data={
'maas_name': new_name,
'enlistment_domain': new_domain,
+ 'http_proxy': new_proxy,
}))
-
- self.assertEqual(httplib.FOUND, response.status_code)
- self.assertEqual(new_name, Config.objects.get_config('maas_name'))
- self.assertEqual(
- new_domain, Config.objects.get_config('enlistment_domain'))
+ get_config = Config.objects.get_config
+ self.assertEqual(httplib.FOUND, response.status_code, response.content)
+ self.assertEqual(new_name, get_config('maas_name'))
+ self.assertEqual(new_domain, get_config('enlistment_domain'))
+ self.assertEqual(new_proxy, get_config('http_proxy'))
def test_settings_commissioning_POST(self):
new_after_commissioning = factory.getRandomEnum(