Merge ~andreserl/maas:lp1513775_fix_named_init_config_packaging into maas:master

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: 9860f0c79cccedded8e9edd1de5add9aabfd0cca
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~andreserl/maas:lp1513775_fix_named_init_config_packaging
Merge into: maas:master
Diff against target: 177 lines (+79/-15)
4 files modified
debian/control (+14/-14)
debian/maas-region-api.dirs (+1/-0)
debian/maas-region-api.postinst (+46/-1)
debian/maas-region-api.postrm (+18/-0)
Reviewer Review Type Date Requested Status
Newell Jensen (community) Approve
MAAS Lander Approve
Review via email: mp+342371@code.launchpad.net

Commit message

LP: #1513775 - Merge maas-dns into maas-region-api

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp1513775_fix_named_init_config_packaging lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: e52ca12700f9c8a4cbf72a90b8f12f4e0341dbaa

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp1513775_fix_named_init_config_packaging lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 296322cf549f2880941503663c42a6d2b5c88e81

review: Approve
Revision history for this message
Newell Jensen (newell-jensen) wrote :

+1

review: Approve
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Looks reasonable to me; just a couple questions below.

Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b lp1513775_fix_named_init_config_packaging lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/2235/consoleText

Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b lp1513775_fix_named_init_config_packaging lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/2238/consoleText

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/control b/debian/control
2index 5281720..a68a402 100644
3--- a/debian/control
4+++ b/debian/control
5@@ -67,7 +67,8 @@ Description: MAAS server common files
6
7 Package: maas-region-api
8 Architecture: all
9-Depends: bind9utils,
10+Depends: bind9 (>= 1:9.10.3.dfsg.P2-5~),
11+ bind9utils,
12 iproute2,
13 libjs-angularjs,
14 libjs-yui3-full,
15@@ -88,9 +89,9 @@ Depends: bind9utils,
16 ubuntu-keyring,
17 ${misc:Depends},
18 ${python3:Depends}
19-Conflicts: maas-region-controller-min, ntp
20-Replaces: maas-region-controller-min
21-Provides: maas-region-controller-min
22+Conflicts: maas-region-controller-min, maas-dns, ntp
23+Replaces: maas-region-controller-min, maas-dns
24+Provides: maas-region-controller-min, maas-dns
25 Description: Region controller API service for MAAS
26 The MAAS region controller consists of REST API services and a postgres
27 database. This package installs only the API services (maas-regiond).
28@@ -101,7 +102,6 @@ Architecture: all
29 Depends: avahi-utils,
30 dbconfig-pgsql,
31 iputils-ping,
32- maas-dns (= ${binary:Version}),
33 maas-region-api (= ${binary:Version}),
34 postgresql (>= 9.1),
35 tcpdump,
36@@ -275,15 +275,15 @@ Description: MAAS DHCP server
37 This package installs and configures a DHCP server that can be used by
38 MAAS, and enhances the overall MAAS user experience.
39
40-Package: maas-dns
41-Architecture: all
42-Depends: bind9 (>= 1:9.10.3.dfsg.P2-5~),
43- maas-region-api (= ${binary:Version}),
44- ${misc:Depends}
45-Conflicts: dnsmasq
46-Description: MAAS DNS server
47- This package installs and configures a DNS server that can be used by
48- MAAS, and enhances the overall MAAS user experience.
49+#Package: maas-dns
50+#Architecture: all
51+#Depends: bind9 (>= 1:9.10.3.dfsg.P2-5~),
52+# maas-region-api (= ${binary:Version}),
53+# ${misc:Depends}
54+#Conflicts: dnsmasq
55+#Description: MAAS DNS server
56+# This package installs and configures a DNS server that can be used by
57+# MAAS, and enhances the overall MAAS user experience.
58
59 Package: maas-proxy
60 Architecture: all
61diff --git a/debian/maas-region-api.dirs b/debian/maas-region-api.dirs
62new file mode 100644
63index 0000000..f49acc7
64--- /dev/null
65+++ b/debian/maas-region-api.dirs
66@@ -0,0 +1 @@
67+etc/bind/maas
68diff --git a/debian/maas-region-api.postinst b/debian/maas-region-api.postinst
69index 7e512c4..1f396d7 100644
70--- a/debian/maas-region-api.postinst
71+++ b/debian/maas-region-api.postinst
72@@ -37,6 +37,40 @@ configure_libdir() {
73 fi
74 }
75
76+edit_named_options() {
77+ # Remove any existing MAAS-related include line from
78+ # /etc/bind/named.conf.local, then re-add it.
79+ sed -i '/^include\s.*maas/d' /etc/bind/named.conf.local
80+ maas-region get_named_conf --edit --config_path /etc/bind/named.conf.local
81+
82+ # Add a line in /etc/bind/named.conf.options that includes the
83+ # /etc/named/maas/named.conf.options.inside.maas file.
84+ maas-region edit_named_options --config-path /etc/bind/named.conf.options
85+}
86+
87+fix_dns_permissions() {
88+ if [ -d /etc/bind/maas ]; then
89+ chown maas:root /etc/bind/maas
90+ chown -R maas:maas /etc/bind/maas/*
91+ fi
92+ if [ -f /etc/bind/maas/named.conf.maas ]; then
93+ chown maas:maas /etc/bind/maas/named.conf.maas
94+ chmod 644 /etc/bind/maas/named.conf.maas
95+ fi
96+ if [ -f /etc/bind/maas/named.conf.options.inside.maas ]; then
97+ chown maas:maas /etc/bind/maas/named.conf.options.inside.maas
98+ chmod 644 /etc/bind/maas/named.conf.options.inside.maas
99+ fi
100+ if [ -f /etc/bind/maas/rndc.conf.maas ]; then
101+ chown maas:root /etc/bind/maas/rndc.conf.maas
102+ chmod 600 /etc/bind/maas/rndc.conf.maas
103+ fi
104+ if [ -f /etc/bind/maas/named.conf.rndc.maas ]; then
105+ chown maas:bind /etc/bind/maas/named.conf.rndc.maas
106+ chmod 640 /etc/bind/maas/named.conf.rndc.maas
107+ fi
108+}
109+
110 # Unconditionally ensure that there is at least an empty configuration
111 # file. This does *not* overwrite any existing configuration.
112 maas-region local_config_set
113@@ -44,14 +78,25 @@ maas-region local_config_set
114 if [ "$1" = "configure" ] && [ -z "$2" ]; then
115 configure_logging
116 configure_libdir
117+ # Configure DNS
118+ # If /etc/bind/maas is empty, set_up_dns.
119+ if [ ! "$(ls -A /etc/bind/maas)" ]; then
120+ maas-region set_up_dns
121+ fi
122+ fix_dns_permissions
123+ edit_named_options
124
125 elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then
126 # Logging changed at r2611, ensure it is set up.
127 configure_logging
128 configure_libdir
129-
130+ # Configure DNS
131+ fix_dns_permissions
132+ edit_named_options
133 fi
134
135+invoke-rc.d bind9 restart || true
136+
137 db_stop
138
139 #DEBHELPER#
140diff --git a/debian/maas-region-api.postrm b/debian/maas-region-api.postrm
141index 9739968..c79533e 100644
142--- a/debian/maas-region-api.postrm
143+++ b/debian/maas-region-api.postrm
144@@ -7,6 +7,14 @@ set -e
145 RELEASE=`lsb_release -rs` || RELEASE=""
146
147 case "$1" in
148+ remove)
149+ if [ -f /etc/bind/named.conf.local ]; then
150+ sed -i '/^include.*\"\/etc\/bind\/maas\/named.conf.maas\"\;$/d' \
151+ /etc/bind/named.conf.local
152+ sed -i '/^include.*\"\/etc\/bind\/maas\/named.conf.options.inside.maas\"\;$/d' \
153+ /etc/bind/named.conf.options
154+ fi
155+ ;;
156 purge)
157 # Remove logging files & foldesr
158 rm -rf /var/log/maas/regiond.log*
159@@ -24,8 +32,18 @@ case "$1" in
160 rm -rf /usr/share/maas/maas/
161 rm -rf /etc/maas/regiond.conf
162 rm -rf /etc/maas/templates.maas-old
163+
164+ # Remove zone files
165+ if [ -d /etc/bind/maas ]; then
166+ rm -rf /etc/bind/maas
167+ fi
168+ ;;
169 esac
170
171+if [ -x /usr/sbin/invoke-rc.d ]; then
172+ invoke-rc.d bind9 restart || true
173+fi
174+
175 #DEBHELPER#
176
177 db_stop

Subscribers

People subscribed via source and target branches