Merge lp:~smoser/maas/packaging.next-server into lp:~maas-maintainers/maas/packaging

Proposed by Scott Moser on 2012-09-14
Status: Merged
Approved by: Scott Moser on 2012-09-14
Approved revision: 88
Merged at revision: 86
Proposed branch: lp:~smoser/maas/packaging.next-server
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 248 lines (+103/-74)
8 files modified
debian/changelog (+2/-1)
debian/maas-dhcp.config (+2/-0)
debian/maas-dhcp.postinst (+12/-1)
debian/maas-dhcp.postrm (+2/-0)
debian/maas-dhcp.templates (+9/-0)
debian/patches/04-add-maas-integration.py (+75/-0)
debian/patches/series (+1/-0)
tests/maas-integration.py (+0/-72)
To merge this branch: bzr merge lp:~smoser/maas/packaging.next-server
Reviewer Review Type Date Requested Status
Andres Rodriguez 2012-09-14 Approve on 2012-09-14
Review via email: mp+124493@code.launchpad.net

Commit Message

update packaging to pass --ip to maas configure_master_dhcp

This makes a change to use debconf to get the (now required) ip address of the dhcp server, via the debconf name 'maas-dhcp/maas-dhcp-addr'. If left blank, it will
pick the ip address of the named interface from the provided maas-dhcp-interface.

There are some other changes lumped in here also.
 * fix a lintian warning in maas-dhcp.postrm
 * move tests/maas-integration.py to a patch in debian/patches/
   Debian packages are not supposed to modify the trunk directly, and
   'debuild -S' complained about changes to that file that were not accounted for.

Description of the Change

update packaging to pass --ip to maas configure_master_dhcp

This makes a change to use debconf to get the (now required) ip address of the dhcp server, via the debconf name 'maas-dhcp/maas-dhcp-addr'. If left blank, it will
pick the ip address of the named interface from the provided maas-dhcp-interface.

There are some other changes lumped in here also.
 * fix a lintian warning in maas-dhcp.postrm
 * move tests/maas-integration.py to a patch in debian/patches/
   Debian packages are not supposed to modify the trunk directly, and
   'debuild -S' complained about changes to that file that were not accounted for.

To post a comment you must log in.
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-09-14 16:58:25 +0000
3+++ debian/changelog 2012-09-14 18:21:20 +0000
4@@ -1,9 +1,10 @@
5-maas (0.1+bzr987+dfsg-0ubuntu3) UNRELEASED; urgency=low
6+maas (0.1+bzr1001+dfsg-0ubuntu3) UNRELEASED; urgency=low
7
8 [ Scott Moser ]
9 * debian/maas-dhcp.{install,apparmor,postrm} install apparmor profile into
10 /etc/apparmor.d/dhcpd.d (LP: #1049177), and update apparmor profile for
11 /usr/sbin/dhcpd on install/remove
12+ * get the ip address for the dhcp server in config
13
14 [ Andres Rodriguez ]
15 * debian/maas.postinst: Always restart apache2.
16
17=== modified file 'debian/maas-dhcp.config'
18--- debian/maas-dhcp.config 2012-09-14 01:27:09 +0000
19+++ debian/maas-dhcp.config 2012-09-14 18:21:20 +0000
20@@ -18,6 +18,8 @@
21 db_go
22 db_input high maas-dhcp/maas-dhcp-interface || true
23 db_go
24+ db_input low maas-dhcp/maas-dhcp-addr || true
25+ db_go
26 fi
27
28 fi
29
30=== modified file 'debian/maas-dhcp.postinst'
31--- debian/maas-dhcp.postinst 2012-09-14 16:58:25 +0000
32+++ debian/maas-dhcp.postinst 2012-09-14 18:21:20 +0000
33@@ -28,9 +28,20 @@
34 db_get maas-dhcp/maas-dhcp-interface || true
35 interface="$RET"
36
37+ # Obtain the interfaces
38+ db_get maas-dhcp/maas-dhcp-addr || true
39+ addr="$RET"
40+
41+ if [ -z "$addr" ]; then
42+ addr=$(ifconfig "$interface" |
43+ awk '$1 == "inet" { sub("addr:","",$2); print $2 }')
44+ [ -n "$addr" ] ||
45+ { echo "failed to get ip for $interface" 1>&2; exit 1; }
46+ fi
47+
48 maas config_master_dhcp --ip-range-low="$range_low" --ip-range-high="$range_high" \
49 --router-ip="$gateway" --subnet-mask="$netmask" --broadcast-ip="$broadcast" \
50- --interface="$interface"
51+ --interface="$interface" --ip="$addr"
52 fi
53
54 fi
55
56=== modified file 'debian/maas-dhcp.postrm'
57--- debian/maas-dhcp.postrm 2012-09-14 16:58:25 +0000
58+++ debian/maas-dhcp.postrm 2012-09-14 18:21:20 +0000
59@@ -7,3 +7,5 @@
60 apparmor_parser --replace --write-cache --skip-read-cache "${dhcpd_prof}"
61 fi
62 fi
63+
64+#DEBHELPER#
65
66=== modified file 'debian/maas-dhcp.templates'
67--- debian/maas-dhcp.templates 2012-09-14 01:27:09 +0000
68+++ debian/maas-dhcp.templates 2012-09-14 18:21:20 +0000
69@@ -54,3 +54,12 @@
70 Ubuntu MAAS Server can manage DHCP for address allocation for
71 the provisioned systems. The DHCP server requires you to set a network
72 interface on which DHCP will serve IP addresses. The default is eth0.
73+
74+Template: maas-dhcp/maas-dhcp-addr
75+Type: string
76+Default:
77+_Description: The IP address at which nodes can reach the DHCP server
78+ Ubuntu MAAS Server can manage DHCP for address allocation for
79+ the provisioned systems. The DHCP server requires you to set an IP
80+ address at which nodes can reach the DHCP server. If left blank
81+ then the ip address of the dhcp-interface will be used.
82
83=== added file 'debian/patches/04-add-maas-integration.py'
84--- debian/patches/04-add-maas-integration.py 1970-01-01 00:00:00 +0000
85+++ debian/patches/04-add-maas-integration.py 2012-09-14 18:21:20 +0000
86@@ -0,0 +1,75 @@
87+--- /dev/null
88++++ b/tests/maas-integration.py
89+@@ -0,0 +1,72 @@
90++# TODO
91++# - send ipmi commands to turn on/off nodes
92++# - run import pxe files
93++# - check node states once they're on/off
94++# - check node state changes (declared -> commissionig -> ready)
95++import os
96++from subprocess import check_output
97++import sys
98++from unittest import TestCase
99++
100++from pyvirtualdisplay import Display
101++from sst.actions import (
102++ assert_url, assert_text_contains, assert_title_contains, click_button,
103++ get_element, go_to, write_textfield)
104++
105++
106++sys.path.insert(0, "/usr/share/maas")
107++os.environ['DJANGO_SETTINGS_MODULE'] = 'maas.settings'
108++from maasserver.models import User
109++
110++MAAS_URL = "http://10.98.0.13/MAAS"
111++ADMIN_USER = "admin"
112++PASSWORD = "test"
113++
114++
115++class TestMAASIntegration(TestCase):
116++
117++ def setUp(self):
118++ self.display = Display(visible=0, size=(1280, 1024))
119++ self.display.start()
120++
121++ def tearDown(self):
122++ self.display.stop()
123++
124++ def createadmin(self):
125++ """Run sudo maas createsuperuser."""
126++ cmd_output = check_output(
127++ ["sudo", "maas", "createsuperuser", "--username=%s" % ADMIN_USER,
128++ "--email=example@canonical.com", "--noinput"])
129++ ## Set password for admin user.
130++ try:
131++ admin = User.objects.get(username=ADMIN_USER)
132++ except User.DoesNotExist:
133++ admin = User(username=ADMIN_USER)
134++ admin.set_password(PASSWORD)
135++ admin.save()
136++ return cmd_output
137++
138++ def installation(self):
139++ # Check the installation worked.
140++ go_to(MAAS_URL)
141++ assert_text_contains(
142++ get_element(tag="body"), "No admin user has been created yet")
143++
144++ def createadmin_and_login(self):
145++ ## Creates the admin user.
146++ output = self.createadmin()
147++ self.assertEqual(output, 'Superuser created successfully.')
148++ ## Login with the newly created admin user
149++ go_to(MAAS_URL)
150++ assert_text_contains(
151++ get_element(tag="body"), "Login to lenovo-RD230-01 MAAS")
152++ write_textfield("id_username", ADMIN_USER)
153++ write_textfield("id_password", PASSWORD)
154++ click_button("Login")
155++ assert_url("MAAS/")
156++ assert_title_contains("Dashboard")
157++
158++ def test_integration(self):
159++ # Run the integration tests in order.
160++ self.installation()
161++ self.createadmin_and_login()
162
163=== modified file 'debian/patches/series'
164--- debian/patches/series 2012-08-29 02:56:47 +0000
165+++ debian/patches/series 2012-09-14 18:21:20 +0000
166@@ -1,3 +1,4 @@
167 01-fix-database-settings.patch
168 02-pserv-config.patch
169 03-txlongpoll-config.patch
170+04-add-maas-integration.py
171
172=== removed directory 'tests'
173=== removed file 'tests/maas-integration.py'
174--- tests/maas-integration.py 2012-09-10 19:28:15 +0000
175+++ tests/maas-integration.py 1970-01-01 00:00:00 +0000
176@@ -1,72 +0,0 @@
177-# TODO
178-# - send ipmi commands to turn on/off nodes
179-# - run import pxe files
180-# - check node states once they're on/off
181-# - check node state changes (declared -> commissionig -> ready)
182-import os
183-from subprocess import check_output
184-import sys
185-from unittest import TestCase
186-
187-from pyvirtualdisplay import Display
188-from sst.actions import (
189- assert_url, assert_text_contains, assert_title_contains, click_button,
190- get_element, go_to, write_textfield)
191-
192-
193-sys.path.insert(0, "/usr/share/maas")
194-os.environ['DJANGO_SETTINGS_MODULE'] = 'maas.settings'
195-from maasserver.models import User
196-
197-MAAS_URL = "http://10.98.0.13/MAAS"
198-ADMIN_USER = "admin"
199-PASSWORD = "test"
200-
201-
202-class TestMAASIntegration(TestCase):
203-
204- def setUp(self):
205- self.display = Display(visible=0, size=(1280, 1024))
206- self.display.start()
207-
208- def tearDown(self):
209- self.display.stop()
210-
211- def createadmin(self):
212- """Run sudo maas createsuperuser."""
213- cmd_output = check_output(
214- ["sudo", "maas", "createsuperuser", "--username=%s" % ADMIN_USER,
215- "--email=example@canonical.com", "--noinput"])
216- ## Set password for admin user.
217- try:
218- admin = User.objects.get(username=ADMIN_USER)
219- except User.DoesNotExist:
220- admin = User(username=ADMIN_USER)
221- admin.set_password(PASSWORD)
222- admin.save()
223- return cmd_output
224-
225- def installation(self):
226- # Check the installation worked.
227- go_to(MAAS_URL)
228- assert_text_contains(
229- get_element(tag="body"), "No admin user has been created yet")
230-
231- def createadmin_and_login(self):
232- ## Creates the admin user.
233- output = self.createadmin()
234- self.assertEqual(output, 'Superuser created successfully.')
235- ## Login with the newly created admin user
236- go_to(MAAS_URL)
237- assert_text_contains(
238- get_element(tag="body"), "Login to lenovo-RD230-01 MAAS")
239- write_textfield("id_username", ADMIN_USER)
240- write_textfield("id_password", PASSWORD)
241- click_button("Login")
242- assert_url("MAAS/")
243- assert_title_contains("Dashboard")
244-
245- def test_integration(self):
246- # Run the integration tests in order.
247- self.installation()
248- self.createadmin_and_login()

Subscribers

People subscribed via source and target branches