← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/bug-1044205-dhcp-dns into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/bug-1044205-dhcp-dns into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #1044205 in MAAS: "manage_dhcp has to be set before dns zone files get written"
  https://bugs.launchpad.net/maas/+bug/1044205

For more details, see:
https://code.launchpad.net/~rvb/maas/bug-1044205-dhcp-dns/+merge/122875

This branch merges the two configuration items 'enable_dns' and 'manage_dhcp' into only item named 'dns_dhcp_management' which can be: 'none' (MAAS won't manage DHCP or DNS), 'Manage DHCP' or 'Manage DNS and DHCP'. This change is required because it is not possible to enable the DNS management without having the DHCP management.

= Pre-imp =

This was pre-imped with Julian (who is also the one who reported the bug that this change fixes).

= Notes =

I changed the default values because we don't what to enable DHCP by default and DNS does not make sense without DHCP.  Hence the default value is to disable DNS and DHCP.

You might wonder about some changes in test_dns.py:

457	-        Config.objects.set_config('manage_dhcp', True)
458	+        enable_dns_management()

447	     def test_get_zone_creates_DNSZoneConfig(self):
448	-        Config.objects.set_config('manage_dhcp', True)
449	+        enable_dns_management()

Prior to that change, the DNS was enabled by default (which does not make sense because DHCP was disabled by default (!)).  The Config.objects.set_config('manage_dhcp', True) was added (I presume) when the config option for DHCP was introduced (after all the DNS stuff) but it was simply a workaround the fact that DNS cannot without DHCP management enabled.  I decided to clear out the air and explicitly enable DNS in the test. 

-- 
https://code.launchpad.net/~rvb/maas/bug-1044205-dhcp-dns/+merge/122875
Your team MAAS Maintainers is requested to review the proposed merge of lp:~rvb/maas/bug-1044205-dhcp-dns into lp:maas.
=== modified file 'src/maasserver/dhcp.py'
--- src/maasserver/dhcp.py	2012-08-21 10:33:21 +0000
+++ src/maasserver/dhcp.py	2012-09-05 13:35:26 +0000
@@ -14,12 +14,14 @@
     'is_dhcp_management_enabled',
     ]
 
+from maasserver.enum import DNS_DHCP_MANAGEMENT
 from maasserver.models import Config
 
 
 def is_dhcp_management_enabled():
     """Is MAAS configured to manage DHCP?
 
-    This status is controlled by the `manage_dhcp` configuration item.
+    This status is controlled by the `dns_dhcp_management` configuration item.
     """
-    return Config.objects.get_config('manage_dhcp')
+    dns_dhcp_management = Config.objects.get_config('dns_dhcp_management')
+    return dns_dhcp_management != DNS_DHCP_MANAGEMENT.NONE

=== modified file 'src/maasserver/dns.py'
--- src/maasserver/dns.py	2012-08-08 13:59:44 +0000
+++ src/maasserver/dns.py	2012-09-05 13:35:26 +0000
@@ -13,6 +13,7 @@
 __all__ = [
     'add_zone',
     'change_dns_zones',
+    'is_dns_enabled',
     'next_zone_serial',
     'write_full_dns_config',
     ]
@@ -23,6 +24,7 @@
 import socket
 
 from django.conf import settings
+from maasserver.enum import DNS_DHCP_MANAGEMENT
 from maasserver.exceptions import MAASException
 from maasserver.models import (
     Config,
@@ -53,7 +55,15 @@
 
 
 def is_dns_enabled():
-    return settings.DNS_CONNECT and Config.objects.get_config('enable_dns')
+    """Is MAAS configured to manage DNS?
+
+    This status is controlled by the `dns_dhcp_management` configuration item.
+    """
+    dns_dhcp_config = Config.objects.get_config('dns_dhcp_management')
+    return (
+        settings.DNS_CONNECT and
+        dns_dhcp_config == DNS_DHCP_MANAGEMENT.DNS_AND_DHCP
+        )
 
 
 class DNSException(MAASException):

=== modified file 'src/maasserver/dns_connect.py'
--- src/maasserver/dns_connect.py	2012-09-03 10:50:27 +0000
+++ src/maasserver/dns_connect.py	2012-09-05 13:35:26 +0000
@@ -19,6 +19,7 @@
     post_save,
     )
 from django.dispatch import receiver
+from maasserver.enum import DNS_DHCP_MANAGEMENT
 from maasserver.models import (
     Config,
     Node,
@@ -30,10 +31,12 @@
 def dns_config_changed(sender, config, created, **kwargs):
     """Signal callback called when the DNS config has changed."""
     from maasserver.dns import write_full_dns_config
-    write_full_dns_config(active=config.value)
-
-
-Config.objects.config_changed_connect('enable_dns', dns_config_changed)
+    dns_enabled = (config.value == DNS_DHCP_MANAGEMENT.DNS_AND_DHCP)
+    write_full_dns_config(active=dns_enabled)
+
+
+Config.objects.config_changed_connect(
+    'dns_dhcp_management', dns_config_changed)
 
 
 @receiver(post_save, sender=NodeGroup)

=== modified file 'src/maasserver/enum.py'
--- src/maasserver/enum.py	2012-08-02 21:01:29 +0000
+++ src/maasserver/enum.py	2012-09-05 13:35:26 +0000
@@ -13,6 +13,8 @@
 __all__ = [
     'ARCHITECTURE',
     'ARCHITECTURE_CHOICES',
+    'DNS_DHCP_MANAGEMENT',
+    'DNS_DHCP_MANAGEMENT_CHOICES',
     'NODE_PERMISSION',
     'NODE_STATUS',
     'NODE_STATUS_CHOICES',
@@ -123,3 +125,16 @@
     COMMISSIONING = 'commissioning'
     ENLIST = 'enlist'
     ENLIST_USERDATA = 'enlist_userdata'
+
+
+class DNS_DHCP_MANAGEMENT:
+    NONE = 'none'
+    DHCP_ONLY = 'dhcp_only'
+    DNS_AND_DHCP = 'dns_and_dhcp'
+
+
+DNS_DHCP_MANAGEMENT_CHOICES = (
+    (DNS_DHCP_MANAGEMENT.NONE, 'Manage none'),
+    (DNS_DHCP_MANAGEMENT.DHCP_ONLY, 'Manage DHCP'),
+    (DNS_DHCP_MANAGEMENT.DNS_AND_DHCP, 'Manage DNS and DHCP'),
+)

=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py	2012-08-24 10:28:29 +0000
+++ src/maasserver/forms.py	2012-09-05 13:35:26 +0000
@@ -45,10 +45,12 @@
     Form,
     ModelForm,
     )
+from django.utils.safestring import mark_safe
 from maasserver.config_forms import SKIP_CHECK_NAME
 from maasserver.enum import (
     ARCHITECTURE,
     ARCHITECTURE_CHOICES,
+    DNS_DHCP_MANAGEMENT_CHOICES,
     NODE_AFTER_COMMISSIONING_ACTION,
     NODE_AFTER_COMMISSIONING_ACTION_CHOICES,
     )
@@ -518,17 +520,19 @@
         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."))
-    enable_dns = forms.BooleanField(
-        label="Enable DNS", required=False, help_text=(
-            "When enabled, MAAS will use the machine's BIND server to "
-            "publish its DNS zones."))
-    manage_dhcp = forms.BooleanField(
-        label="Manage DHCP", required=False, help_text=(
-            "When enabled, MAAS workers will work with ISC DHCP servers, "
-            "if suitably configured, to give each DHCP client its own host "
-            "map.  Unlike normal leases, these host maps never expire.  "
-            "Thus enabling DHCP management ensures that a node will never "
-            "change its IP address."))
+    dns_dhcp_management = forms.ChoiceField(
+        label="DNS and DHCP servers management",
+        choices=DNS_DHCP_MANAGEMENT_CHOICES,
+        help_text=mark_safe(
+            "If MAAS manages the DHCP server, MAAS workers will work with ISC "
+            "DHCP servers, if suitably configured, to give each DHCP client "
+            "its own host map.  Unlike normal leases, these host maps never "
+            "expire.  Thus enabling DHCP management ensures that a node will "
+            "never change its IP address. <br />"
+            "If MAAS manages the DNS server, it will use the machine's BIND "
+            "server to publish its DNS zones.  Note that this can be enabled "
+            "only if MAAS also manages the DHCP server as MAAS needs the "
+            "lease information in order to populate the DNS zones."))
 
 
 class CommissioningForm(ConfigForm):

=== modified file 'src/maasserver/management/commands/config_master_dhcp.py'
--- src/maasserver/management/commands/config_master_dhcp.py	2012-09-04 05:51:25 +0000
+++ src/maasserver/management/commands/config_master_dhcp.py	2012-09-05 13:35:26 +0000
@@ -25,6 +25,7 @@
     )
 
 from django.core.management.base import BaseCommand
+from maasserver.enum import DNS_DHCP_MANAGEMENT
 from maasserver.models import (
     Config,
     NodeGroup,
@@ -106,7 +107,11 @@
                 setattr(master_nodegroup, item, value)
             master_nodegroup.save()
 
-            # Enable DHCP management and create a Task that will
-            # write the config out.
-            Config.objects.set_config('manage_dhcp', True)
+            # Enable DHCP management if it was previously disabled.
+            dns_dhcp_management = Config.objects.get_config(
+                'dns_dhcp_management')
+            if dns_dhcp_management == DNS_DHCP_MANAGEMENT.NONE:
+                Config.objects.set_config(
+                    'dns_dhcp_management', DNS_DHCP_MANAGEMENT.DHCP_ONLY)
+            # Create a Task that will write the config out.
             master_nodegroup.set_up_dhcp()

=== modified file 'src/maasserver/models/config.py'
--- src/maasserver/models/config.py	2012-08-28 08:22:38 +0000
+++ src/maasserver/models/config.py	2012-09-05 13:35:26 +0000
@@ -26,7 +26,10 @@
     )
 from django.db.models.signals import post_save
 from maasserver import DefaultMeta
-from maasserver.enum import NODE_AFTER_COMMISSIONING_ACTION
+from maasserver.enum import (
+    DNS_DHCP_MANAGEMENT,
+    NODE_AFTER_COMMISSIONING_ACTION,
+    )
 from maasserver.fields import JSONObjectField
 from provisioningserver.enum import POWER_TYPE
 
@@ -48,8 +51,7 @@
         # Network section configuration.
         'maas_name': gethostname(),
         'enlistment_domain': b'local',
-        'enable_dns': True,
-        'manage_dhcp': False,
+        'dns_dhcp_management': DNS_DHCP_MANAGEMENT.NONE,
         ## /settings
         }
 

=== modified file 'src/maasserver/testing/__init__.py'
--- src/maasserver/testing/__init__.py	2012-08-24 10:28:29 +0000
+++ src/maasserver/testing/__init__.py	2012-09-05 13:35:26 +0000
@@ -11,6 +11,10 @@
 
 __metaclass__ = type
 __all__ = [
+    "disable_dhcp_management",
+    "disable_dns_management",
+    "enable_dhcp_management",
+    "enable_dns_management",
     "extract_redirect",
     "get_content_links",
     "get_data",
@@ -24,6 +28,8 @@
 from urlparse import urlparse
 
 from lxml.html import fromstring
+from maasserver.enum import DNS_DHCP_MANAGEMENT
+from maasserver.models import Config
 from maasserver.utils.orm import get_one
 
 
@@ -121,3 +127,32 @@
     doc = fromstring(response.content)
     [content_node] = doc.cssselect(element)
     return [elem.get('href') for elem in content_node.cssselect('a')]
+
+
+def enable_dhcp_management():
+    """Turn MAAS DHCP management on."""
+    # Circular import.
+    from maasserver.testing.factory import factory
+    config = factory.getRandomEnum(
+        DNS_DHCP_MANAGEMENT, but_not=(DNS_DHCP_MANAGEMENT.NONE,))
+    Config.objects.set_config('dns_dhcp_management', config)
+
+
+def enable_dns_management():
+    """Turn MAAS DNS management on."""
+    Config.objects.set_config(
+        'dns_dhcp_management', DNS_DHCP_MANAGEMENT.DNS_AND_DHCP)
+
+
+def disable_dhcp_management():
+    """Turn MAAS DHCP management off."""
+    Config.objects.set_config('dns_dhcp_management', DNS_DHCP_MANAGEMENT.NONE)
+
+
+def disable_dns_management():
+    """Turn MAAS DNS management off."""
+    # Circular import.
+    from maasserver.testing.factory import factory
+    config = factory.getRandomEnum(
+        DNS_DHCP_MANAGEMENT, but_not=(DNS_DHCP_MANAGEMENT.DNS_AND_DHCP,))
+    Config.objects.set_config('dns_dhcp_management', config)

=== modified file 'src/maasserver/testing/factory.py'
--- src/maasserver/testing/factory.py	2012-09-04 04:47:28 +0000
+++ src/maasserver/testing/factory.py	2012-09-05 13:35:26 +0000
@@ -51,13 +51,19 @@
 
 class Factory(maastesting.factory.Factory):
 
-    def getRandomEnum(self, enum):
+    def getRandomEnum(self, enum, but_not=None):
         """Pick a random item from an enumeration class.
 
         :param enum: An enumeration class such as `NODE_STATUS`.
         :return: The value of one of its items.
+        :param but_not: A list of choices' IDs to exclude.
+        :type but_not: Sequence.
         """
-        return random.choice(list(map_enum(enum).values()))
+        if but_not is None:
+            but_not = ()
+        return random.choice([
+            value for value in list(map_enum(enum).values())
+            if value not in but_not])
 
     def getRandomChoice(self, choices, but_not=None):
         """Pick a random item from `choices`.

=== modified file 'src/maasserver/testing/tests/test_factory.py'
--- src/maasserver/testing/tests/test_factory.py	2012-07-30 11:01:31 +0000
+++ src/maasserver/testing/tests/test_factory.py	2012-09-05 13:35:26 +0000
@@ -31,6 +31,19 @@
         self.assertIn(
             factory.getRandomEnum(Enum), [Enum.VALUE, Enum.OTHER_VALUE])
 
+    def test_getRandomEnum_can_exclude_choices(self):
+        random_value = randint(0, 99999)
+
+        class Enum:
+            FIRST_VALUE = random_value
+            SECOND_VALUE = random_value + 1
+            THIRD_VALUE = random_value + 2
+
+        self.assertEqual(
+            Enum.FIRST_VALUE,
+            factory.getRandomEnum(
+                Enum, but_not=(Enum.SECOND_VALUE, Enum.THIRD_VALUE)))
+
     def test_getRandomChoice_chooses_from_django_options(self):
         options = [(2, 'b'), (10, 'j')]
         self.assertIn(

=== modified file 'src/maasserver/tests/test_api.py'
--- src/maasserver/tests/test_api.py	2012-09-03 04:59:58 +0000
+++ src/maasserver/tests/test_api.py	2012-09-05 13:35:26 +0000
@@ -68,6 +68,8 @@
     )
 from maasserver.refresh_worker import refresh_worker
 from maasserver.testing import (
+    disable_dhcp_management,
+    enable_dhcp_management,
     reload_object,
     reload_objects,
     )
@@ -2416,16 +2418,6 @@
         get_worker_user(), token=nodegroup.api_token)
 
 
-def enable_dhcp_management():
-    """Turn MAAS DHCP management on."""
-    Config.objects.set_config('manage_dhcp', True)
-
-
-def disable_dhcp_management():
-    """Turn MAAS DHCP management on, or off."""
-    Config.objects.set_config('manage_dhcp', False)
-
-
 class TestNodeGroupAPI(APITestCase):
 
     resources = (

=== modified file 'src/maasserver/tests/test_commands_config_master_dhcp.py'
--- src/maasserver/tests/test_commands_config_master_dhcp.py	2012-09-04 15:06:20 +0000
+++ src/maasserver/tests/test_commands_config_master_dhcp.py	2012-09-05 13:35:26 +0000
@@ -15,11 +15,13 @@
 from optparse import OptionValueError
 
 from django.core.management import call_command
+from maasserver.enum import DNS_DHCP_MANAGEMENT
 from maasserver.management.commands.config_master_dhcp import name_option
 from maasserver.models import (
     Config,
     NodeGroup,
     )
+from maasserver.testing import disable_dhcp_management
 from maasserver.testing.factory import factory
 from maasserver.testing.testcase import TestCase
 from testtools.matchers import MatchesStructure
@@ -130,7 +132,20 @@
     def test_sets_up_dhcp_and_enables_it(self):
         master = NodeGroup.objects.ensure_master()
         settings = make_dhcp_settings()
-        Config.objects.set_config('manage_dhcp', False)
-        call_command('config_master_dhcp', **settings)
-        self.assertEqual(1, master.set_up_dhcp.call_count)
-        self.assertTrue(Config.objects.get_config('manage_dhcp'))
+        disable_dhcp_management()
+        call_command('config_master_dhcp', **settings)
+        self.assertEqual(1, master.set_up_dhcp.call_count)
+        self.assertEqual(
+            Config.objects.get_config('dns_dhcp_management'),
+            DNS_DHCP_MANAGEMENT.DHCP_ONLY)
+
+    def test_sets_up_dhcp_preserves_dns_dhcp_setting_if_dhcp_enabled(self):
+        master = NodeGroup.objects.ensure_master()
+        settings = make_dhcp_settings()
+        dns_dhcp_config = DNS_DHCP_MANAGEMENT.DNS_AND_DHCP
+        Config.objects.set_config('dns_dhcp_management', dns_dhcp_config)
+        call_command('config_master_dhcp', **settings)
+        self.assertEqual(1, master.set_up_dhcp.call_count)
+        self.assertEqual(
+            Config.objects.get_config('dns_dhcp_management'),
+            dns_dhcp_config)

=== modified file 'src/maasserver/tests/test_dhcp.py'
--- src/maasserver/tests/test_dhcp.py	2012-08-30 07:21:11 +0000
+++ src/maasserver/tests/test_dhcp.py	2012-09-05 13:35:26 +0000
@@ -13,7 +13,10 @@
 __all__ = []
 
 from maasserver.dhcp import is_dhcp_management_enabled
-from maasserver.models import Config
+from maasserver.testing import (
+    disable_dhcp_management,
+    enable_dhcp_management,
+    )
 from maasserver.testing.testcase import TestCase
 
 
@@ -22,6 +25,10 @@
     def test_is_dhcp_management_enabled_defaults_to_False(self):
         self.assertFalse(is_dhcp_management_enabled())
 
-    def test_is_dhcp_management_enabled_follows_manage_dhcp_config(self):
-        Config.objects.set_config('manage_dhcp', True)
+    def test_is_dhcp_management_enabled_dns_dhcp_management_True(self):
+        enable_dhcp_management()
         self.assertTrue(is_dhcp_management_enabled())
+
+    def test_is_dhcp_management_enabled_dns_dhcp_management_False(self):
+        disable_dhcp_management()
+        self.assertFalse(is_dhcp_management_enabled())

=== modified file 'src/maasserver/tests/test_dns.py'
--- src/maasserver/tests/test_dns.py	2012-09-03 10:50:27 +0000
+++ src/maasserver/tests/test_dns.py	2012-09-05 13:35:26 +0000
@@ -24,8 +24,11 @@
     dns,
     server_address,
     )
-from maasserver.models import Config
 from maasserver.models.dhcplease import DHCPLease
+from maasserver.testing import (
+    disable_dns_management,
+    enable_dns_management,
+    )
 from maasserver.testing.factory import factory
 from maasserver.testing.testcase import TestCase
 from maastesting.bindfixture import BINDServer
@@ -90,7 +93,7 @@
         self.assertRaises(dns.DNSException, dns.get_dns_server_address)
 
     def test_get_zone_creates_DNSZoneConfig(self):
-        Config.objects.set_config('manage_dhcp', True)
+        enable_dns_management()
         nodegroup = factory.make_node_group()
         serial = random.randint(1, 100)
         zone = dns.get_zone(nodegroup, serial)
@@ -121,7 +124,7 @@
 
     def setUp(self):
         super(TestDNSConfigModifications, self).setUp()
-        Config.objects.set_config('manage_dhcp', True)
+        enable_dns_management()
         self.bind = self.useFixture(BINDServer())
         self.patch(conf, 'DNS_CONFIG_DIR', self.bind.config.homedir)
 
@@ -223,12 +226,12 @@
         self.assertFalse(dns.is_dns_enabled())
 
     def test_is_dns_enabled_return_false_if_confif_enable_dns_False(self):
-        Config.objects.set_config('enable_dns', False)
+        disable_dns_management()
         self.assertFalse(dns.is_dns_enabled())
 
     def test_is_dns_enabled_return_True(self):
         self.patch(settings, 'DNS_CONNECT', True)
-        Config.objects.set_config('enable_dns', True)
+        enable_dns_management()
         self.assertTrue(dns.is_dns_enabled())
 
     def test_change_dns_zone_changes_doesnt_write_conf_if_dhcp_disabled(self):
@@ -361,11 +364,11 @@
         self.patch(settings, "DNS_CONNECT", False)
         nodegroup, node, lease = self.create_nodegroup_with_lease()
         settings.DNS_CONNECT = True
-        Config.objects.set_config('enable_dns', True)
+        enable_dns_management()
         self.assertDNSMatches(node.hostname, nodegroup.name, lease.ip)
 
     def test_change_config_enable_dns_disables_dns(self):
         self.patch(settings, "DNS_CONNECT", True)
         nodegroup, node, lease = self.create_nodegroup_with_lease()
-        Config.objects.set_config('enable_dns', False)
+        disable_dns_management()
         self.assertEqual([''], self.dig_resolve(generated_hostname(lease.ip)))

=== modified file 'src/maasserver/tests/test_nodegroup.py'
--- src/maasserver/tests/test_nodegroup.py	2012-09-04 15:06:20 +0000
+++ src/maasserver/tests/test_nodegroup.py	2012-09-05 13:35:26 +0000
@@ -14,11 +14,12 @@
 
 import maasserver
 from maasserver.dns import get_dns_server_address
-from maasserver.models import (
-    Config,
-    NodeGroup,
+from maasserver.models import NodeGroup
+from maasserver.testing import (
+    disable_dhcp_management,
+    enable_dhcp_management,
+    reload_object,
     )
-from maasserver.testing import reload_object
 from maasserver.testing.factory import factory
 from maasserver.testing.testcase import TestCase
 from maasserver.worker_user import get_worker_user
@@ -163,15 +164,15 @@
         )
 
     def test_is_dhcp_enabled_returns_True_if_fully_set_up(self):
-        Config.objects.set_config('manage_dhcp', True)
+        enable_dhcp_management()
         self.assertTrue(factory.make_node_group().is_dhcp_enabled())
 
     def test_is_dhcp_enabled_returns_False_if_disabled(self):
-        Config.objects.set_config('manage_dhcp', False)
+        disable_dhcp_management()
         self.assertFalse(factory.make_node_group().is_dhcp_enabled())
 
     def test_is_dhcp_enabled_returns_False_if_config_is_missing(self):
-        Config.objects.set_config('manage_dhcp', True)
+        enable_dhcp_management()
         required_fields = [
             'subnet_mask', 'broadcast_ip', 'ip_range_low', 'ip_range_high']
         # Map each required field's name to a nodegroup that has just

=== modified file 'src/maasserver/tests/test_views_settings.py'
--- src/maasserver/tests/test_views_settings.py	2012-08-21 10:47:56 +0000
+++ src/maasserver/tests/test_views_settings.py	2012-09-05 13:35:26 +0000
@@ -18,7 +18,10 @@
 from django.contrib.auth.models import User
 from django.core.urlresolvers import reverse
 from lxml.html import fromstring
-from maasserver.enum import NODE_AFTER_COMMISSIONING_ACTION
+from maasserver.enum import (
+    DNS_DHCP_MANAGEMENT,
+    NODE_AFTER_COMMISSIONING_ACTION,
+    )
 from maasserver.models import (
     Config,
     UserProfile,
@@ -78,8 +81,7 @@
         self.patch(settings, "DNS_CONNECT", False)
         new_name = factory.getRandomString()
         new_domain = factory.getRandomString()
-        new_enable_dns = factory.getRandomBoolean()
-        new_manage_dhcp = factory.getRandomBoolean()
+        new_dns_dhcp_management = factory.getRandomEnum(DNS_DHCP_MANAGEMENT)
         response = self.client.post(
             reverse('settings'),
             get_prefixed_form_data(
@@ -87,8 +89,7 @@
                 data={
                     'maas_name': new_name,
                     'enlistment_domain': new_domain,
-                    'enable_dns ': new_enable_dns,
-                    'manage_dhcp': new_manage_dhcp,
+                    'dns_dhcp_management': new_dns_dhcp_management,
                 }))
 
         self.assertEqual(httplib.FOUND, response.status_code)
@@ -96,9 +97,8 @@
         self.assertEqual(
             new_domain, Config.objects.get_config('enlistment_domain'))
         self.assertEqual(
-            new_enable_dns, Config.objects.get_config('enable_dns'))
-        self.assertEqual(
-            new_manage_dhcp, Config.objects.get_config('manage_dhcp'))
+            new_dns_dhcp_management,
+            Config.objects.get_config('dns_dhcp_management'))
 
     def test_settings_commissioning_POST(self):
         new_after_commissioning = factory.getRandomEnum(