Merge lp:~jtv/maas/hardcode-dhcpv6-path into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 2824
Proposed branch: lp:~jtv/maas/hardcode-dhcpv6-path
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 87 lines (+8/-11)
4 files modified
etc/celeryconfig_common.py (+0/-2)
etc/democeleryconfig_common.py (+0/-2)
src/provisioningserver/rpc/dhcp.py (+6/-4)
src/provisioningserver/rpc/tests/test_dhcp.py (+2/-3)
To merge this branch: bzr merge lp:~jtv/maas/hardcode-dhcpv6-path
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+232208@code.launchpad.net

Commit message

Hard-code paths to DHCPv6 files, instead of taking them from Celery config.

At the point where these paths are needed, the celery config does not seem to contain them! I only see a very minimal celery config, not all the settings we define in celeryconfig_common.py. It's not quite worth digging up, because we're in the process of removing this configuration anyway.

Description of the change

It's hard to keep track of changes in execution environment with everybody working on different things. Julian used a similar approach for a similar problem the other day.

The one advantage of the configuring this in the Celery file is that we can have a different setting for development branches, but it does not make much sense to serve DHCP from a branch.

Jeroen

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'etc/celeryconfig_common.py'
2--- etc/celeryconfig_common.py 2014-08-22 11:23:35 +0000
3+++ etc/celeryconfig_common.py 2014-08-26 12:50:49 +0000
4@@ -29,11 +29,9 @@
5
6 # ISC dhcpd configuration files.
7 DHCP_CONFIG_FILE = '/etc/maas/dhcpd.conf'
8-DHCPv6_CONFIG_FILE = '/etc/maas/dhcpd6.conf'
9
10 # List of interfaces that the dhcpd should service (if managed by MAAS).
11 DHCP_INTERFACES_FILE = '/var/lib/maas/dhcpd-interfaces'
12-DHCPv6_INTERFACES_FILE = '/var/lib/maas/dhcpd6-interfaces'
13
14 # Broker connection information. This is read by the region controller
15 # and sent to connecting cluster controllers.
16
17=== modified file 'etc/democeleryconfig_common.py'
18--- etc/democeleryconfig_common.py 2014-08-22 11:23:35 +0000
19+++ etc/democeleryconfig_common.py 2014-08-26 12:50:49 +0000
20@@ -37,8 +37,6 @@
21
22 DHCP_CONFIG_FILE = os.path.join(
23 DEV_ROOT_DIRECTORY, 'run/dhcpd.conf')
24-DHCPv6_CONFIG_FILE = os.path.join(
25- DEV_ROOT_DIRECTORY, 'run/dhcpd6.conf')
26
27
28 DHCP_LEASES_FILE = os.path.join(
29
30=== modified file 'src/provisioningserver/rpc/dhcp.py'
31--- src/provisioningserver/rpc/dhcp.py 2014-08-26 03:25:43 +0000
32+++ src/provisioningserver/rpc/dhcp.py 2014-08-26 12:50:49 +0000
33@@ -18,7 +18,6 @@
34 "remove_host_maps",
35 ]
36
37-from celery.app import app_or_default
38 from provisioningserver.dhcp.config import get_config
39 from provisioningserver.dhcp.control import (
40 restart_dhcpv6,
41@@ -37,8 +36,11 @@
42
43 maaslog = get_maas_logger("dhcp")
44
45+# Location of the DHCPv6 configuration file.
46+DHCPv6_CONFIG_FILE = '/etc/maas/dhcp6.conf'
47
48-celery_config = app_or_default().conf
49+# Location of the DHCPv6 interfaces file.
50+DHCPv6_INTERFACES_FILE = '/var/lib/maas/dhcpd6-interfaces'
51
52
53 def configure_dhcpv6(omapi_key, subnet_configs):
54@@ -56,8 +58,8 @@
55 'dhcpd6.conf.template',
56 omapi_key=omapi_key, dhcp_subnets=subnet_configs)
57 try:
58- sudo_write_file(celery_config.DHCPv6_CONFIG_FILE, dhcpd_config)
59- sudo_write_file(celery_config.DHCPv6_INTERFACES_FILE, interfaces)
60+ sudo_write_file(DHCPv6_CONFIG_FILE, dhcpd_config)
61+ sudo_write_file(DHCPv6_INTERFACES_FILE, interfaces)
62 except ExternalProcessError as e:
63 # ExternalProcessError.__unicode__ contains a generic failure message
64 # as well as the command and its error output. On the other hand,
65
66=== modified file 'src/provisioningserver/rpc/tests/test_dhcp.py'
67--- src/provisioningserver/rpc/tests/test_dhcp.py 2014-08-25 11:08:45 +0000
68+++ src/provisioningserver/rpc/tests/test_dhcp.py 2014-08-26 12:50:49 +0000
69@@ -95,8 +95,7 @@
70
71 self.assertThat(
72 write_file,
73- MockAnyCall(
74- dhcp.celery_config.DHCPv6_CONFIG_FILE, expected_config))
75+ MockAnyCall(dhcp.DHCPv6_CONFIG_FILE, expected_config))
76
77 def test__writes_interfaces_file(self):
78 write_file = self.patch_sudo_write_file()
79@@ -104,7 +103,7 @@
80 dhcp.configure_dhcpv6(factory.make_name('key'), [make_subnet_config()])
81 self.assertThat(
82 write_file,
83- MockCalledWith(dhcp.celery_config.DHCPv6_INTERFACES_FILE, ANY))
84+ MockCalledWith(dhcp.DHCPv6_INTERFACES_FILE, ANY))
85
86 def test__restarts_dhcpv6_server_if_subnets_defined(self):
87 self.patch_sudo_write_file()