Merge lp:~andreserl/maas/packaging_clusterd_conf into lp:~maas-maintainers/maas/packaging
- packaging_clusterd_conf
- Merge into packaging
Proposed by
Andres Rodriguez
Status: | Superseded |
---|---|
Proposed branch: | lp:~andreserl/maas/packaging_clusterd_conf |
Merge into: | lp:~maas-maintainers/maas/packaging |
Diff against target: |
522 lines (+66/-195) 15 files modified
debian/maas-cluster-controller.config (+3/-3) debian/maas-cluster-controller.install (+0/-6) debian/maas-cluster-controller.maas-clusterd.service (+2/-3) debian/maas-cluster-controller.maas-clusterd.upstart (+1/-1) debian/maas-cluster-controller.postinst (+22/-40) debian/maas-region-controller-min.apport (+3/-1) debian/maas-region-controller-min.install (+0/-3) debian/maas-region-controller-min.links (+0/-1) debian/maas-region-controller-min.maas-regiond.service (+1/-1) debian/maas-region-controller-min.postinst (+6/-69) debian/maas-region-controller.config (+1/-1) debian/maas-region-controller.postinst (+27/-28) debian/patches/01-fix-database-settings.patch (+0/-17) debian/patches/02-pserv-config.patch (+0/-19) debian/patches/series (+0/-2) |
To merge this branch: | bzr merge lp:~andreserl/maas/packaging_clusterd_conf |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
MAAS Maintainers | Pending | ||
Review via email: mp+257020@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-04-22.
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/maas-cluster-controller.config' | |||
2 | --- debian/maas-cluster-controller.config 2013-03-19 19:44:20 +0000 | |||
3 | +++ debian/maas-cluster-controller.config 2015-04-22 01:44:57 +0000 | |||
4 | @@ -12,8 +12,8 @@ | |||
5 | 12 | db_get maas-cluster-controller/maas-url || true | 12 | db_get maas-cluster-controller/maas-url || true |
6 | 13 | if [ -z "$RET" ]; then | 13 | if [ -z "$RET" ]; then |
7 | 14 | # Attempt to pre-populate if installing on the region controller. | 14 | # Attempt to pre-populate if installing on the region controller. |
10 | 15 | if [ -e /etc/maas/maas_local_settings.py ]; then | 15 | if [ -e /etc/maas/regiond.conf ]; then |
11 | 16 | url=$(awk '$1 == "DEFAULT_MAAS_URL" { split($0,array,"\"")} END{print array[2] }' /etc/maas/maas_local_settings.py) | 16 | url=$(awk '$1 == "maas_url:" { split($0,array," ")} END{print array[2] }' /etc/maas/regiond.conf) |
12 | 17 | # If the URL doesn't end in /MAAS then add it. This helps upgrades from | 17 | # If the URL doesn't end in /MAAS then add it. This helps upgrades from |
13 | 18 | # precise for which the URL didn't contain /MAAS, which is now required | 18 | # precise for which the URL didn't contain /MAAS, which is now required |
14 | 19 | if ! echo $url | grep -qs "/MAAS$"; then | 19 | if ! echo $url | grep -qs "/MAAS$"; then |
15 | @@ -22,7 +22,7 @@ | |||
16 | 22 | db_set maas-cluster-controller/maas-url "$url" | 22 | db_set maas-cluster-controller/maas-url "$url" |
17 | 23 | else | 23 | else |
18 | 24 | # Will only get here if dbconf value not already set, or | 24 | # Will only get here if dbconf value not already set, or |
20 | 25 | # /etc/maas/maas_local_settings.py doesn't exist. | 25 | # /etc/maas/regiond.conf doesn't exist. |
21 | 26 | db_input medium maas-cluster-controller/maas-url || true | 26 | db_input medium maas-cluster-controller/maas-url || true |
22 | 27 | db_go | 27 | db_go |
23 | 28 | fi | 28 | fi |
24 | 29 | 29 | ||
25 | === modified file 'debian/maas-cluster-controller.install' | |||
26 | --- debian/maas-cluster-controller.install 2015-03-25 16:35:38 +0000 | |||
27 | +++ debian/maas-cluster-controller.install 2015-04-22 01:44:57 +0000 | |||
28 | @@ -1,12 +1,6 @@ | |||
29 | 1 | # Install twisted plugins | 1 | # Install twisted plugins |
30 | 2 | twisted/plugins/maasclusterd.py usr/share/pyshared/twisted/plugins | 2 | twisted/plugins/maasclusterd.py usr/share/pyshared/twisted/plugins |
31 | 3 | 3 | ||
32 | 4 | # Install PSERV config file | ||
33 | 5 | debian/tmp/etc/maas/pserv.yaml | ||
34 | 6 | |||
35 | 7 | # Install cluster config file | ||
36 | 8 | debian/tmp/etc/maas/maas_cluster.conf | ||
37 | 9 | |||
38 | 10 | # Install templates | 4 | # Install templates |
39 | 11 | debian/tmp/etc/maas/templates/dhcp | 5 | debian/tmp/etc/maas/templates/dhcp |
40 | 12 | debian/tmp/etc/maas/templates/power | 6 | debian/tmp/etc/maas/templates/power |
41 | 13 | 7 | ||
42 | === modified file 'debian/maas-cluster-controller.maas-clusterd.service' | |||
43 | --- debian/maas-cluster-controller.maas-clusterd.service 2015-03-17 20:12:30 +0000 | |||
44 | +++ debian/maas-cluster-controller.maas-clusterd.service 2015-04-22 01:44:57 +0000 | |||
45 | @@ -5,16 +5,15 @@ | |||
46 | 5 | ConditionPathExists=/etc/maas/maas_cluster.conf | 5 | ConditionPathExists=/etc/maas/maas_cluster.conf |
47 | 6 | # This (pserv.yaml) will go away once streamline | 6 | # This (pserv.yaml) will go away once streamline |
48 | 7 | # config files or move to sqlite. | 7 | # config files or move to sqlite. |
50 | 8 | ConditionPathExists=/etc/maas/pserv.yaml | 8 | ConditionPathExists=/etc/maas/clusterd.conf |
51 | 9 | ConditionPathExists=/var/lib/maas/secret | 9 | ConditionPathExists=/var/lib/maas/secret |
52 | 10 | 10 | ||
53 | 11 | [Service] | 11 | [Service] |
54 | 12 | Restart=on-failure | 12 | Restart=on-failure |
55 | 13 | EnvironmentFile=/etc/maas/maas_cluster.conf | ||
56 | 14 | ExecStart=/bin/sh -ec '\ | 13 | ExecStart=/bin/sh -ec '\ |
57 | 15 | exec /usr/bin/authbind --deep /usr/bin/twistd \ | 14 | exec /usr/bin/authbind --deep /usr/bin/twistd \ |
58 | 16 | --nodaemon --uid=maas --gid=maas --pidfile=/run/maas-cluster.pid \ | 15 | --nodaemon --uid=maas --gid=maas --pidfile=/run/maas-cluster.pid \ |
60 | 17 | maas-clusterd --config-file=/etc/maas/pserv.yaml > \ | 16 | maas-clusterd --config-file=/etc/maas/clusterd.conf > \ |
61 | 18 | /var/log/maas/clusterd.log 2>&1' | 17 | /var/log/maas/clusterd.log 2>&1' |
62 | 19 | 18 | ||
63 | 20 | [Install] | 19 | [Install] |
64 | 21 | 20 | ||
65 | === modified file 'debian/maas-cluster-controller.maas-clusterd.upstart' | |||
66 | --- debian/maas-cluster-controller.maas-clusterd.upstart 2015-01-23 14:56:56 +0000 | |||
67 | +++ debian/maas-cluster-controller.maas-clusterd.upstart 2015-04-22 01:44:57 +0000 | |||
68 | @@ -6,7 +6,7 @@ | |||
69 | 6 | 6 | ||
70 | 7 | respawn | 7 | respawn |
71 | 8 | 8 | ||
73 | 9 | env CONFIG_FILE=/etc/maas/maas_cluster.conf | 9 | env CONFIG_FILE=/etc/maas/clusterd.conf |
74 | 10 | env LOGFILE=/var/log/maas/clusterd.log | 10 | env LOGFILE=/var/log/maas/clusterd.log |
75 | 11 | 11 | ||
76 | 12 | pre-start script | 12 | pre-start script |
77 | 13 | 13 | ||
78 | === modified file 'debian/maas-cluster-controller.postinst' | |||
79 | --- debian/maas-cluster-controller.postinst 2015-03-17 17:15:56 +0000 | |||
80 | +++ debian/maas-cluster-controller.postinst 2015-04-22 01:44:57 +0000 | |||
81 | @@ -39,7 +39,8 @@ | |||
82 | 39 | extract_cluster_uuid(){ | 39 | extract_cluster_uuid(){ |
83 | 40 | # Extract ClUSTER_UUID setting from config file $1. This will work | 40 | # Extract ClUSTER_UUID setting from config file $1. This will work |
84 | 41 | # the cluster config (which is shell). | 41 | # the cluster config (which is shell). |
86 | 42 | sed -n -e "s/^CLUSTER_UUID *= *[\"']\([^\"']*\).*/\1/p" "$1" | 42 | #awk '$1 == "cluster_uuid:" { split($0,array," ")} END{print array[2] }' "$1" |
87 | 43 | awk '{ split($1,array,"\"")} END{print array[2] }' "$1" | ||
88 | 43 | } | 44 | } |
89 | 44 | 45 | ||
90 | 45 | configure_cluster_uuid(){ | 46 | configure_cluster_uuid(){ |
91 | @@ -48,23 +49,13 @@ | |||
92 | 48 | # we want to generate one. | 49 | # we want to generate one. |
93 | 49 | local uuid | 50 | local uuid |
94 | 50 | 51 | ||
96 | 51 | if [ -n "$(extract_cluster_uuid /etc/maas/maas_cluster.conf)" ]; then | 52 | uuid=$(awk '$1 == "cluster_uuid:" { split($0,array," ")} END{print array[2] }' "/etc/maas/clusterd.conf") |
97 | 53 | if [ -n "$uuid" ]; then | ||
98 | 52 | # UUID is already set up. Wonderful. | 54 | # UUID is already set up. Wonderful. |
99 | 53 | return | 55 | return |
100 | 54 | else | 56 | else |
101 | 55 | # No UUID at all yet. Generate one. | 57 | # No UUID at all yet. Generate one. |
114 | 56 | uuid="$(uuidgen)" | 58 | maas-provision config --init |
103 | 57 | fi | ||
104 | 58 | |||
105 | 59 | # Write the uuid to maas_cluster.conf | ||
106 | 60 | # There is no initial placeholder in this file, so just append the setting. | ||
107 | 61 | echo "CLUSTER_UUID=\"$uuid\"" >>/etc/maas/maas_cluster.conf | ||
108 | 62 | } | ||
109 | 63 | |||
110 | 64 | enable_apache_version_mod(){ | ||
111 | 65 | COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) | ||
112 | 66 | if [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then | ||
113 | 67 | a2enmod version | ||
115 | 68 | fi | 59 | fi |
116 | 69 | } | 60 | } |
117 | 70 | 61 | ||
118 | @@ -83,19 +74,11 @@ | |||
119 | 83 | chmod 700 /etc/authbind/byuid/$MAAS_UID | 74 | chmod 700 /etc/authbind/byuid/$MAAS_UID |
120 | 84 | } | 75 | } |
121 | 85 | 76 | ||
122 | 86 | restart_apache2(){ | ||
123 | 87 | if [ -x /usr/sbin/invoke-rc.d ]; then | ||
124 | 88 | invoke-rc.d apache2 restart || true | ||
125 | 89 | else | ||
126 | 90 | /etc/init.d/apache2 restart || true | ||
127 | 91 | fi | ||
128 | 92 | } | ||
129 | 93 | |||
130 | 94 | configure_maas_url(){ | 77 | configure_maas_url(){ |
131 | 95 | # Get the MAAS_URL on configure/reconfigure and write it to the conf files. | 78 | # Get the MAAS_URL on configure/reconfigure and write it to the conf files. |
132 | 96 | db_get maas-cluster-controller/maas-url || true | 79 | db_get maas-cluster-controller/maas-url || true |
133 | 97 | if [ -n "$RET" ]; then | 80 | if [ -n "$RET" ]; then |
135 | 98 | maas-provision configure-maas-url "$RET" | 81 | maas-provision config --region-url "$RET" |
136 | 99 | fi | 82 | fi |
137 | 100 | } | 83 | } |
138 | 101 | 84 | ||
139 | @@ -108,36 +91,35 @@ | |||
140 | 108 | fi | 91 | fi |
141 | 109 | } | 92 | } |
142 | 110 | 93 | ||
143 | 111 | |||
144 | 112 | if [ "$1" = "configure" ] && [ -z "$2" ]; then | 94 | if [ "$1" = "configure" ] && [ -z "$2" ]; then |
145 | 113 | create_log_dir | 95 | create_log_dir |
146 | 114 | configure_maas_tgt | 96 | configure_maas_tgt |
155 | 115 | fi | 97 | configure_maas_url |
156 | 116 | 98 | configure_cluster_uuid | |
157 | 117 | if [ "$1" = "configure" ]; then | 99 | configure_cluster_authbind |
158 | 118 | if dpkg --compare-versions "$2" lt 0.1+bzr1239+dfsg-0ubuntu1; then | 100 | maas-provision upgrade-cluster |
159 | 119 | create_log_dir | 101 | |
160 | 120 | fi | 102 | elif [ -n "$DEBCONF_RECONFIGURE" ]; then |
153 | 121 | |||
154 | 122 | configure_maas_tgt | ||
161 | 123 | configure_maas_url | 103 | configure_maas_url |
162 | 124 | # Only ask for a shared secret when the region is not installed | 104 | # Only ask for a shared secret when the region is not installed |
163 | 125 | # on the same system. | 105 | # on the same system. |
165 | 126 | if [ -n "$DEBCONF_RECONFIGURE" ] && [ ! -f /usr/sbin/maas-region-admin ]; then | 106 | if [ ! -f /usr/sbin/maas-region-admin ]; then |
166 | 127 | db_input high maas-cluster-controller/shared-secret | 107 | db_input high maas-cluster-controller/shared-secret |
167 | 128 | db_go | 108 | db_go |
168 | 129 | fi | 109 | fi |
169 | 130 | configure_shared_secret | 110 | configure_shared_secret |
170 | 131 | 111 | ||
175 | 132 | # This config file may contain a private cluster UUID. Only maas | 112 | elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then |
176 | 133 | # can read it; only root can write it. | 113 | # If we are upgrading from an older version, then we need |
177 | 134 | chown root:maas /etc/maas/maas_cluster.conf | 114 | # to obtain the *old* CLUSTER UUID and set it. |
178 | 135 | chmod 0640 /etc/maas/maas_cluster.conf | 115 | if [ -f /etc/maas/maas_cluster.conf ]; then |
179 | 116 | uuid=$(extract_cluster_uuid) | ||
180 | 117 | maas-provision config --uuid "$uuid" | ||
181 | 118 | mv /etc/maas/maas_cluster.conf /etc/maas/maas_cluster.conf.maas-old | ||
182 | 119 | mv /etc/maas/pserv.yaml /etc/maas/pserv.yaml.maas-old | ||
183 | 120 | fi | ||
184 | 136 | 121 | ||
185 | 137 | configure_cluster_uuid | ||
186 | 138 | configure_cluster_authbind | 122 | configure_cluster_authbind |
187 | 139 | enable_apache_version_mod | ||
188 | 140 | restart_apache2 | ||
189 | 141 | maas-provision upgrade-cluster | 123 | maas-provision upgrade-cluster |
190 | 142 | fi | 124 | fi |
191 | 143 | 125 | ||
192 | 144 | 126 | ||
193 | === modified file 'debian/maas-region-controller-min.apport' | |||
194 | --- debian/maas-region-controller-min.apport 2015-01-21 16:24:16 +0000 | |||
195 | +++ debian/maas-region-controller-min.apport 2015-04-22 01:44:57 +0000 | |||
196 | @@ -21,7 +21,7 @@ | |||
197 | 21 | 21 | ||
198 | 22 | def add_info(report, ui): | 22 | def add_info(report, ui): |
199 | 23 | response = ui.yesno( | 23 | response = ui.yesno( |
201 | 24 | "The contents of your /etc/maas/maas_local_settings.py, " | 24 | "The contents of your /etc/maas/regiond.conf, " |
202 | 25 | "/etc/maas/pserv.yaml files may help developers diagnose your bug " | 25 | "/etc/maas/pserv.yaml files may help developers diagnose your bug " |
203 | 26 | "more quickly. However, it may contain sensitive information. Do " | 26 | "more quickly. However, it may contain sensitive information. Do " |
204 | 27 | "you want to include it in your bug report?") | 27 | "you want to include it in your bug report?") |
205 | @@ -30,6 +30,8 @@ | |||
206 | 30 | raise StopIteration | 30 | raise StopIteration |
207 | 31 | elif response is True: | 31 | elif response is True: |
208 | 32 | attach_conffiles(report, 'maas') | 32 | attach_conffiles(report, 'maas') |
209 | 33 | attach_file_if_exists( | ||
210 | 34 | report, '/etc/maas/regiond.conf', 'MAASRegionConfig') | ||
211 | 33 | 35 | ||
212 | 34 | # Attaching log files | 36 | # Attaching log files |
213 | 35 | attach_file_if_exists( | 37 | attach_file_if_exists( |
214 | 36 | 38 | ||
215 | === modified file 'debian/maas-region-controller-min.install' | |||
216 | --- debian/maas-region-controller-min.install 2014-11-05 16:38:22 +0000 | |||
217 | +++ debian/maas-region-controller-min.install 2015-04-22 01:44:57 +0000 | |||
218 | @@ -7,9 +7,6 @@ | |||
219 | 7 | # Install Apache Config | 7 | # Install Apache Config |
220 | 8 | debian/tmp/etc/maas/maas-http.conf | 8 | debian/tmp/etc/maas/maas-http.conf |
221 | 9 | 9 | ||
222 | 10 | # Install MAAS local settings | ||
223 | 11 | debian/tmp/etc/maas/maas_local_settings.py | ||
224 | 12 | |||
225 | 13 | # Install new preseed files | 10 | # Install new preseed files |
226 | 14 | debian/tmp/etc/maas/preseeds | 11 | debian/tmp/etc/maas/preseeds |
227 | 15 | 12 | ||
228 | 16 | 13 | ||
229 | === removed file 'debian/maas-region-controller-min.links' | |||
230 | --- debian/maas-region-controller-min.links 2014-09-25 20:19:36 +0000 | |||
231 | +++ debian/maas-region-controller-min.links 1970-01-01 00:00:00 +0000 | |||
232 | @@ -1,1 +0,0 @@ | |||
233 | 1 | etc/maas/maas_local_settings.py usr/share/maas/maas_local_settings.py | ||
234 | 2 | 0 | ||
235 | === modified file 'debian/maas-region-controller-min.maas-regiond.service' | |||
236 | --- debian/maas-region-controller-min.maas-regiond.service 2015-03-20 23:06:34 +0000 | |||
237 | +++ debian/maas-region-controller-min.maas-regiond.service 2015-04-22 01:44:57 +0000 | |||
238 | @@ -3,7 +3,7 @@ | |||
239 | 3 | Requires=network-online.target | 3 | Requires=network-online.target |
240 | 4 | After=network-online.target | 4 | After=network-online.target |
241 | 5 | # This will go away one we support new config files. | 5 | # This will go away one we support new config files. |
243 | 6 | ConditionPathExists=/etc/maas/maas_local_settings.py | 6 | ConditionPathExists=/etc/maas/regiond.conf |
244 | 7 | 7 | ||
245 | 8 | [Service] | 8 | [Service] |
246 | 9 | Restart=on-failure | 9 | Restart=on-failure |
247 | 10 | 10 | ||
248 | === modified file 'debian/maas-region-controller-min.postinst' | |||
249 | --- debian/maas-region-controller-min.postinst 2015-02-11 14:22:53 +0000 | |||
250 | +++ debian/maas-region-controller-min.postinst 2015-04-22 01:44:57 +0000 | |||
251 | @@ -8,22 +8,12 @@ | |||
252 | 8 | RELEASE=`lsb_release -rs` || RELEASE="" | 8 | RELEASE=`lsb_release -rs` || RELEASE="" |
253 | 9 | 9 | ||
254 | 10 | configure_region_http() { | 10 | configure_region_http() { |
271 | 11 | case $RELEASE in | 11 | # handle apache configs |
272 | 12 | 12.04|12.10|13.04) | 12 | if [ -e /etc/maas/maas-http.conf -a \ |
273 | 13 | # handle apache configs | 13 | ! -e /etc/apache2/conf-enabled/maas-http.conf ]; then |
274 | 14 | if [ -e /etc/maas/maas-http.conf -a \ | 14 | ln -sf /etc/maas/maas-http.conf /etc/apache2/conf-enabled/maas-http.conf |
275 | 15 | ! -e /etc/apache2/conf.d/maas-http.conf ]; then | 15 | fi |
276 | 16 | ln -sf /etc/maas/maas-http.conf /etc/apache2/conf.d/maas-http.conf | 16 | |
261 | 17 | fi | ||
262 | 18 | ;; | ||
263 | 19 | *) | ||
264 | 20 | # handle apache configs | ||
265 | 21 | if [ -e /etc/maas/maas-http.conf -a \ | ||
266 | 22 | ! -e /etc/apache2/conf-enabled/maas-http.conf ]; then | ||
267 | 23 | ln -sf /etc/maas/maas-http.conf /etc/apache2/conf-enabled/maas-http.conf | ||
268 | 24 | fi | ||
269 | 25 | ;; | ||
270 | 26 | esac | ||
277 | 27 | # enable apache modules needed | 17 | # enable apache modules needed |
278 | 28 | a2enmod proxy_http | 18 | a2enmod proxy_http |
279 | 29 | a2enmod expires | 19 | a2enmod expires |
280 | @@ -60,25 +50,6 @@ | |||
281 | 60 | ln -sf /var/log/apache2 /var/log/maas/ | 50 | ln -sf /var/log/apache2 /var/log/maas/ |
282 | 61 | } | 51 | } |
283 | 62 | 52 | ||
284 | 63 | configure_maas_default_url() { | ||
285 | 64 | local ipaddr="$1" | ||
286 | 65 | |||
287 | 66 | if grep -qs "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py; then | ||
288 | 67 | sed -i "s/^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$/DEFAULT_MAAS_URL = \"http:\/\/$ipaddr\/MAAS\"/" /etc/maas/maas_local_settings.py | ||
289 | 68 | fi | ||
290 | 69 | } | ||
291 | 70 | |||
292 | 71 | get_default_route_ip() { | ||
293 | 72 | while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do | ||
294 | 73 | [ "$Mask" = "00000000" ] && break | ||
295 | 74 | done < /proc/net/route | ||
296 | 75 | interface="$Iface" | ||
297 | 76 | ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global) | ||
298 | 77 | ipaddr=${ipaddr#* inet } | ||
299 | 78 | ipaddr=${ipaddr%%/*} | ||
300 | 79 | echo $ipaddr | ||
301 | 80 | } | ||
302 | 81 | |||
303 | 82 | if [ "$1" = "configure" ] && [ -z "$2" ]; then | 53 | if [ "$1" = "configure" ] && [ -z "$2" ]; then |
304 | 83 | ######################################################### | 54 | ######################################################### |
305 | 84 | ################ Folder Permissions #################### | 55 | ################ Folder Permissions #################### |
306 | @@ -86,47 +57,17 @@ | |||
307 | 86 | mkdir -p /var/lib/maas/media/storage | 57 | mkdir -p /var/lib/maas/media/storage |
308 | 87 | chown -R maas:maas /var/lib/maas/ | 58 | chown -R maas:maas /var/lib/maas/ |
309 | 88 | 59 | ||
310 | 89 | # Config will contain credentials, so should be readable | ||
311 | 90 | # by the application but nobody else. | ||
312 | 91 | chown root:maas /etc/maas/maas_local_settings.py | ||
313 | 92 | chmod 0640 /etc/maas/maas_local_settings.py | ||
314 | 93 | |||
315 | 94 | ######################################################### | 60 | ######################################################### |
316 | 95 | ################ Configure Apache2 #################### | 61 | ################ Configure Apache2 #################### |
317 | 96 | ######################################################### | 62 | ######################################################### |
318 | 97 | configure_region_http | 63 | configure_region_http |
319 | 98 | 64 | ||
320 | 99 | ######################################################### | 65 | ######################################################### |
321 | 100 | ########## Configure DEFAULT_MAAS_URL ################# | ||
322 | 101 | ######################################################### | ||
323 | 102 | |||
324 | 103 | # Obtain IP address of default route and change DEFAULT_MAAS_URL | ||
325 | 104 | # if default-maas-url has not been preseeded. | ||
326 | 105 | db_get maas/default-maas-url | ||
327 | 106 | ipaddr="$RET" | ||
328 | 107 | if [ -z "$RET" ]; then | ||
329 | 108 | ipaddr=$(get_default_route_ip) | ||
330 | 109 | fi | ||
331 | 110 | # Set the IP address of the interface with default route | ||
332 | 111 | if [ -n "$ipaddr" ]; then | ||
333 | 112 | configure_maas_default_url "$ipaddr" | ||
334 | 113 | db_set maas/default-maas-url "$ipaddr" | ||
335 | 114 | fi | ||
336 | 115 | |||
337 | 116 | ######################################################### | ||
338 | 117 | ################ Configure Logging #################### | 66 | ################ Configure Logging #################### |
339 | 118 | ######################################################### | 67 | ######################################################### |
340 | 119 | configure_logging | 68 | configure_logging |
341 | 120 | configure_third_party_log_symlinks | 69 | configure_third_party_log_symlinks |
342 | 121 | 70 | ||
343 | 122 | elif [ -n "$DEBCONF_RECONFIGURE" ]; then | ||
344 | 123 | # Set the IP address of the interface with default route | ||
345 | 124 | db_get maas/default-maas-url | ||
346 | 125 | ipaddr="$RET" | ||
347 | 126 | if [ -n "$ipaddr" ]; then | ||
348 | 127 | configure_maas_default_url "$ipaddr" | ||
349 | 128 | fi | ||
350 | 129 | |||
351 | 130 | elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then | 71 | elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then |
352 | 131 | # Logging changed at r2611, ensure it is set up. | 72 | # Logging changed at r2611, ensure it is set up. |
353 | 132 | configure_logging | 73 | configure_logging |
354 | @@ -138,10 +79,6 @@ | |||
355 | 138 | # make sure maas http config is symlinked | 79 | # make sure maas http config is symlinked |
356 | 139 | configure_region_http | 80 | configure_region_http |
357 | 140 | 81 | ||
358 | 141 | # we need to regenerate the passwords and update configs. | ||
359 | 142 | db_get maas/default-maas-url | ||
360 | 143 | ipaddr="$RET" | ||
361 | 144 | configure_maas_default_url "$ipaddr" | ||
362 | 145 | fi | 82 | fi |
363 | 146 | 83 | ||
364 | 147 | invoke-rc.d apache2 restart || true | 84 | invoke-rc.d apache2 restart || true |
365 | 148 | 85 | ||
366 | === modified file 'debian/maas-region-controller.config' | |||
367 | --- debian/maas-region-controller.config 2013-03-20 16:44:30 +0000 | |||
368 | +++ debian/maas-region-controller.config 2015-04-22 01:44:57 +0000 | |||
369 | @@ -37,7 +37,7 @@ | |||
370 | 37 | elif [ -n "$DEBCONF_RECONFIGURE" ]; then | 37 | elif [ -n "$DEBCONF_RECONFIGURE" ]; then |
371 | 38 | db_get maas/default-maas-url || true | 38 | db_get maas/default-maas-url || true |
372 | 39 | if [ -z "$RET" ]; then | 39 | if [ -z "$RET" ]; then |
374 | 40 | ipaddr=$(awk '$1 == "DEFAULT_MAAS_URL" { split($0,array,"/")} END{print array[3] }' /etc/maas/maas_local_settings.py) | 40 | ipaddr=$(awk '$1 == "maas_url:" { split($0,array,"/")} END{print array[3] }' /etc/maas/regiond.conf) |
375 | 41 | db_set maas/default-maas-url "$ipaddr" | 41 | db_set maas/default-maas-url "$ipaddr" |
376 | 42 | fi | 42 | fi |
377 | 43 | db_input low maas/default-maas-url || true | 43 | db_input low maas/default-maas-url || true |
378 | 44 | 44 | ||
379 | === modified file 'debian/maas-region-controller.postinst' | |||
380 | --- debian/maas-region-controller.postinst 2015-04-08 22:14:39 +0000 | |||
381 | +++ debian/maas-region-controller.postinst 2015-04-22 01:44:57 +0000 | |||
382 | @@ -23,19 +23,12 @@ | |||
383 | 23 | 23 | ||
384 | 24 | configure_maas_database() { | 24 | configure_maas_database() { |
385 | 25 | local dbc_dbpass="$1" | 25 | local dbc_dbpass="$1" |
390 | 26 | if grep -qs "^\ \{1,\} 'PASSWORD': '[a-zA-Z0-9]\{0,\}',$" /etc/maas/maas_local_settings.py; then | 26 | maas-region-admin config --dbpassword "$dbc_dbpass" |
387 | 27 | sed -i "s/^\ \{1,\} 'PASSWORD': '[a-zA-Z0-9]\{0,\}',$/ 'PASSWORD': '"$dbc_dbpass"',/" \ | ||
388 | 28 | /etc/maas/maas_local_settings.py | ||
389 | 29 | fi | ||
391 | 30 | } | 27 | } |
392 | 31 | 28 | ||
393 | 32 | configure_maas_default_url() { | 29 | configure_maas_default_url() { |
394 | 33 | local ipaddr="$1" | 30 | local ipaddr="$1" |
400 | 34 | 31 | maas-region-admin config --default-url "http://${ipaddr}/MAAS" | |
396 | 35 | if grep -qs "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py; then | ||
397 | 36 | sed -i "s/^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$/DEFAULT_MAAS_URL = \"http:\/\/"$ipaddr"\/MAAS\"/" \ | ||
398 | 37 | /etc/maas/maas_local_settings.py | ||
399 | 38 | fi | ||
401 | 39 | } | 32 | } |
402 | 40 | 33 | ||
403 | 41 | get_default_route_ip() { | 34 | get_default_route_ip() { |
404 | @@ -57,11 +50,6 @@ | |||
405 | 57 | mkdir -p /var/lib/maas/media/storage | 50 | mkdir -p /var/lib/maas/media/storage |
406 | 58 | chown -R maas:maas /var/lib/maas/ | 51 | chown -R maas:maas /var/lib/maas/ |
407 | 59 | 52 | ||
408 | 60 | # Config will contain credentials, so should be readable | ||
409 | 61 | # by the application but nobody else. | ||
410 | 62 | chown root:maas /etc/maas/maas_local_settings.py | ||
411 | 63 | chmod 0640 /etc/maas/maas_local_settings.py | ||
412 | 64 | |||
413 | 65 | ######################################################### | 53 | ######################################################### |
414 | 66 | ########## Configure DEFAULT_MAAS_URL ################# | 54 | ########## Configure DEFAULT_MAAS_URL ################# |
415 | 67 | ######################################################### | 55 | ######################################################### |
416 | @@ -89,7 +77,8 @@ | |||
417 | 89 | 77 | ||
418 | 90 | # Create the database | 78 | # Create the database |
419 | 91 | dbc_go maas-region-controller $@ | 79 | dbc_go maas-region-controller $@ |
421 | 92 | configure_maas_database "$dbc_dbpass" | 80 | maas-region-admin config --dbhost "localhost" --dbname "$dbc_dbname" \ |
422 | 81 | --dbuser "$dbc_dbuser" --dbpassword "$dbc_dbpass" | ||
423 | 93 | 82 | ||
424 | 94 | # Only syncdb if we have selected to install it with dbconfig-common. | 83 | # Only syncdb if we have selected to install it with dbconfig-common. |
425 | 95 | db_get maas-region-controller/dbconfig-install | 84 | db_get maas-region-controller/dbconfig-install |
426 | @@ -116,20 +105,30 @@ | |||
427 | 116 | # make sure postgresql is running | 105 | # make sure postgresql is running |
428 | 117 | restart_postgresql | 106 | restart_postgresql |
429 | 118 | 107 | ||
442 | 119 | # we need to regenerate the passwords and update configs. | 108 | # If the version we are upgrading from ("$2") is less than 1.8.0~alpha10+bzr3754-0ubuntu1 |
443 | 120 | db_get maas/default-maas-url | 109 | # then we need migrate to new config file. |
444 | 121 | ipaddr="$RET" | 110 | # TODO, we need to update this to the appropriate version |
445 | 122 | configure_maas_default_url "$ipaddr" | 111 | if dpkg --compare-versions "$2" lt 1.8.0~alpha10+bzr3754-0ubuntu1 && [ -f /etc/maas/maas_local_settings.py ]; then |
446 | 123 | # handle database upgrade | 112 | # we need to regenerate the passwords and update configs. |
447 | 124 | if [ -f /etc/dbconfig-common/maas-region-controller.conf ]; then | 113 | db_get maas/default-maas-url |
448 | 125 | # source dbconfig-common db config for maas-region-controller | 114 | ipaddr="$RET" |
449 | 126 | # before upgrading database, otherwise a new config is written | 115 | configure_maas_default_url "$ipaddr" |
450 | 127 | # but the password is no longer preserved. | 116 | # handle database upgrade |
451 | 128 | . /etc/dbconfig-common/maas-region-controller.conf | 117 | if [ -f /etc/dbconfig-common/maas-region-controller.conf ]; then |
452 | 129 | else | 118 | # source dbconfig-common db config for maas-region-controller |
453 | 130 | dbc_go maas-region-controller $@ | 119 | # before upgrading database, otherwise a new config is written |
454 | 120 | # but the password is no longer preserved. | ||
455 | 121 | . /etc/dbconfig-common/maas-region-controller.conf | ||
456 | 122 | else | ||
457 | 123 | dbc_go maas-region-controller $@ | ||
458 | 124 | fi | ||
459 | 125 | |||
460 | 126 | # Reconfigure the config file. | ||
461 | 127 | maas-region-admin config --dbhost "localhost" --dbname "$dbc_dbname" \ | ||
462 | 128 | --dbuser "$dbc_dbuser" --dbpassword "$dbc_dbpass" | ||
463 | 129 | |||
464 | 130 | mv /etc/maas/maas_local_settings.py /etc/maas/maas_local_settings.py.maas-old | ||
465 | 131 | fi | 131 | fi |
466 | 132 | configure_maas_database "$dbc_dbpass" | ||
467 | 133 | 132 | ||
468 | 134 | maas_sync_migrate_db | 133 | maas_sync_migrate_db |
469 | 135 | 134 | ||
470 | 136 | 135 | ||
471 | === removed file 'debian/patches/01-fix-database-settings.patch' | |||
472 | --- debian/patches/01-fix-database-settings.patch 2015-01-23 14:56:56 +0000 | |||
473 | +++ debian/patches/01-fix-database-settings.patch 1970-01-01 00:00:00 +0000 | |||
474 | @@ -1,17 +0,0 @@ | |||
475 | 1 | Index: maas-1.8.0~alpha1+bzr3486.orig/contrib/maas_local_settings.py | ||
476 | 2 | =================================================================== | ||
477 | 3 | --- maas-1.8.0~alpha1+bzr3486.orig.orig/contrib/maas_local_settings.py 2015-01-23 09:50:03.185579822 -0500 | ||
478 | 4 | +++ maas-1.8.0~alpha1+bzr3486.orig/contrib/maas_local_settings.py 2015-01-23 09:50:03.181579822 -0500 | ||
479 | 5 | @@ -14,9 +14,9 @@ | ||
480 | 6 | 'default': { | ||
481 | 7 | # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' etc. | ||
482 | 8 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
483 | 9 | - 'NAME': '', | ||
484 | 10 | - 'USER': '', | ||
485 | 11 | - 'PASSWORD': '', | ||
486 | 12 | + 'NAME': 'maasdb', | ||
487 | 13 | + 'USER': 'maas', | ||
488 | 14 | + 'PASSWORD': 'maas', | ||
489 | 15 | 'HOST': 'localhost', | ||
490 | 16 | } | ||
491 | 17 | } | ||
492 | 18 | 0 | ||
493 | === removed file 'debian/patches/02-pserv-config.patch' | |||
494 | --- debian/patches/02-pserv-config.patch 2015-02-18 04:09:08 +0000 | |||
495 | +++ debian/patches/02-pserv-config.patch 1970-01-01 00:00:00 +0000 | |||
496 | @@ -1,19 +0,0 @@ | |||
497 | 1 | Description: Use default settings for MAAS PSERV | ||
498 | 2 | Use default settings for MAAS pserv. These default settings | ||
499 | 3 | include port, logfile, oops directory, cobbler url and username | ||
500 | 4 | Author: Andres Rodriguez <andreserl@ubuntu.com> | ||
501 | 5 | |||
502 | 6 | === modified file 'etc/maas/pserv.yaml' | ||
503 | 7 | Index: maas-1.8.0~alpha1+bzr3523.orig/etc/maas/pserv.yaml | ||
504 | 8 | =================================================================== | ||
505 | 9 | --- maas-1.8.0~alpha1+bzr3523.orig.orig/etc/maas/pserv.yaml 2015-02-17 22:25:42.304015180 -0500 | ||
506 | 10 | +++ maas-1.8.0~alpha1+bzr3523.orig/etc/maas/pserv.yaml 2015-02-17 22:25:42.300015180 -0500 | ||
507 | 11 | @@ -18,8 +18,6 @@ | ||
508 | 12 | # resource_root: /var/lib/maas/boot-resources/current/ | ||
509 | 13 | |||
510 | 14 | # port: 69 | ||
511 | 15 | - port: 5244 | ||
512 | 16 | ## The URL to be contacted to generate PXE configurations. | ||
513 | 17 | # generator: http://localhost/MAAS/api/1.0/pxeconfig/ | ||
514 | 18 | - generator: http://localhost:5240/api/1.0/pxeconfig/ | ||
515 | 19 | |||
516 | 20 | 0 | ||
517 | === modified file 'debian/patches/series' | |||
518 | --- debian/patches/series 2014-12-05 15:21:37 +0000 | |||
519 | +++ debian/patches/series 2015-04-22 01:44:57 +0000 | |||
520 | @@ -1,2 +0,0 @@ | |||
521 | 1 | 01-fix-database-settings.patch | ||
522 | 2 | 02-pserv-config.patch |