← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/pre-apply-dhcp_interfaces into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/pre-apply-dhcp_interfaces into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~jtv/maas/pre-apply-dhcp_interfaces/+merge/122795

See the commit message.  I did not pre-imp this separately; I extracted the changes from my other branch to keep the diff down.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/pre-apply-dhcp_interfaces/+merge/122795
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/maas/pre-apply-dhcp_interfaces into lp:maas.
=== modified file 'src/provisioningserver/dhcp/tests/test_config.py'
--- src/provisioningserver/dhcp/tests/test_config.py	2012-08-21 15:59:48 +0000
+++ src/provisioningserver/dhcp/tests/test_config.py	2012-09-05 06:20:34 +0000
@@ -17,8 +17,8 @@
 from maastesting.matchers import Contains
 from provisioningserver.dhcp import config
 from provisioningserver.pxe.tftppath import compose_bootloader_path
+from provisioningserver.testing.testcase import PservTestCase
 import tempita
-from testtools import TestCase
 from testtools.matchers import MatchesRegex
 
 # Simple test version of the DHCP template.  Contains parameter
@@ -54,7 +54,7 @@
         )
 
 
-class TestDHCPConfig(TestCase):
+class TestDHCPConfig(PservTestCase):
 
     def patch_template(self, template_content=sample_template):
         """Patch the DHCP config template with the given contents."""

=== modified file 'src/provisioningserver/tests/test_tasks.py'
--- src/provisioningserver/tests/test_tasks.py	2012-09-04 10:20:35 +0000
+++ src/provisioningserver/tests/test_tasks.py	2012-09-05 06:20:34 +0000
@@ -15,7 +15,10 @@
 from datetime import datetime
 import os
 import random
-from subprocess import CalledProcessError
+from subprocess import (
+    CalledProcessError,
+    PIPE,
+    )
 
 from apiclient.creds import convert_tuple_to_string
 from celeryconfig import DHCP_CONFIG_FILE
@@ -157,6 +160,7 @@
     def make_dhcp_config_params(self):
         """Fake up a dict of dhcp configuration parameters."""
         param_names = [
+<<<<<<< TREE
             'omapi_key',
             'subnet',
             'subnet_mask',
@@ -167,6 +171,19 @@
             'ip_range_low',
             'ip_range_high',
             ]
+=======
+             'dhcp_interfaces',
+             'omapi_key',
+             'subnet',
+             'subnet_mask',
+             'next_server',
+             'broadcast_ip',
+             'dns_servers',
+             'router_ip',
+             'ip_range_low',
+             'ip_range_high',
+             ]
+>>>>>>> MERGE-SOURCE
         return {param: factory.getRandomString() for param in param_names}
 
     def test_upload_dhcp_leases(self):
@@ -237,15 +254,13 @@
         write_dhcp_config(**config_params)
 
         # It should construct Popen with the right parameters.
-        popen_args = mocked_popen.call_args[0][0]
-        self.assertEqual(
-            popen_args,
+        mocked_popen.assert_any_call(
             ["sudo", "maas-provision", "atomic-write", "--filename",
-            DHCP_CONFIG_FILE, "--mode", "744"])
+            DHCP_CONFIG_FILE, "--mode", "744"], stdin=PIPE)
 
         # It should then pass the content to communicate().
         content = config.get_config(**config_params).encode("ascii")
-        mocked_proc.communicate.assert_called_once_with(content)
+        mocked_proc.communicate.assert_any_call(content)
 
         # Finally it should restart the dhcp server.
         check_call_args = mocked_check_call.call_args