1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210 | #!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_version 2.0
RELEASE=`lsb_release -rs` || RELEASE=""
create_var_dir() {
# create var dir
if [ ! -d /var/lib/maas ]; then
mkdir -p /var/lib/maas
fi
chown -R maas:maas /var/lib/maas/
}
create_log_dir() {
# Give appropriate permissions
if [ ! -f /var/log/maas/rackd.log ]; then
touch /var/log/maas/rackd.log
fi
chown maas:maas /var/log/maas/rackd.log
}
configure_maas_tgt() {
# Ensure that iSCSI targets get re-defined on reboot.
# Creates a softlink in /etc/tgt/conf.d/ that points to the current
# boot images' tgt configuration.
mkdir -p /etc/tgt/conf.d
ln -sf /var/lib/maas/boot-resources/current/maas.tgt /etc/tgt/conf.d/maas.conf
}
extract_cluster_uuid(){
# Extract ClUSTER_UUID setting from config file $1. This will work
# on the old the cluster config file (which is shell).
awk '{ split($1,array,"\"")} END{print array[2] }' "$1"
}
extract_maas_url(){
# Extract the MAAS_URL setting from the config file $1.
grep -Eo "https?://[^ ]+" "$1" | cut -d"\"" -f1
}
configure_cluster_uuid(){
# This will configure a UUID if one has not previously been set.
maas-provision config --init
}
configure_cluster_authbind() {
MAAS_UID="`id -u maas`"
if [ ! -f "/etc/authbind/byuid/$MAAS_UID" ]; then
if [ ! -d "/etc/authbind/byuid" ]; then
mkdir -p /etc/authbind/byuid
chmod 755 /etc/authbind
chmod 755 /etc/authbind/byuid
fi
fi
echo '0.0.0.0/0:68,69' >/etc/authbind/byuid/$MAAS_UID
echo '::/0,68-69' >>/etc/authbind/byuid/$MAAS_UID
chown maas:maas /etc/authbind/byuid/$MAAS_UID
chmod 700 /etc/authbind/byuid/$MAAS_UID
}
configure_maas_url(){
# Get the MAAS URL on configure/reconfigure and write it to the conf files.
db_get maas-rack-controller/maas-url || true
if [ -n "$RET" ]; then
maas-provision config --region-url "$RET"
fi
}
configure_shared_secret() {
db_get maas-rack-controller/shared-secret || true
if [ -n "$RET" ]; then
echo "$RET" | maas-provision install-shared-secret
chown maas:maas /var/lib/maas/secret
chmod 0640 /var/lib/maas/secret
fi
}
rack_controller_upgrade() {
# If we are upgrading from an older version, then we need to obtain
# the cluster UUID from the old configuration file and set it with
# the new configuration tool.
# If upgrading from 1.5, 1.7, 1.8
set -x
if [ -f /etc/maas/maas_cluster.conf ]; then
uuid=$(extract_cluster_uuid /etc/maas/maas_cluster.conf)
maas-provision config --uuid "$uuid"
maas_url=$(extract_maas_url /etc/maas/maas_cluster.conf)
maas-provision config --region-url "$maas_url"
db_set maas-rack-controller/maas-url "$maas_url"
mv /etc/maas/maas_cluster.conf /etc/maas/maas_cluster.conf.maas-old
mv /etc/maas/pserv.yaml /etc/maas/pserv.yaml.maas-old
fi
# if upgrading from 1.9
if [ -f /etc/maas/clusterd.conf ]; then
mv /etc/maas/clusterd.conf /etc/maas/rackd.conf
fi
}
# Unconditionally ensure that there is at least an empty configuration
# file. This does *not* overwrite any existing configuration.
maas-provision config
if [ "$1" = "configure" ] && [ -z "$2" ]; then
create_log_dir
create_var_dir
configure_maas_tgt
configure_maas_url
configure_cluster_uuid
configure_cluster_authbind
maas-provision upgrade-cluster
rack_controller_upgrade
elif [ -n "$DEBCONF_RECONFIGURE" ]; then
configure_maas_url
# Only ask for a shared secret when the region is not installed
# on the same system.
if [ ! -f /usr/sbin/maas-region-admin ]; then
db_input high maas-rack-controller/shared-secret
db_go
fi
configure_shared_secret
elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then
configure_cluster_authbind
maas-provision upgrade-cluster
fi
db_stop
# Automatically added by dhpython:
if which py3compile >/dev/null 2>&1; then
py3compile -p maas-rack-controller -V 3.5-
fi
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/maas-rackd" ]; then
update-rc.d maas-rackd defaults >/dev/null
fi
if [ -x "/etc/init.d/maas-rackd" ] || [ -e "/etc/init/maas-rackd.conf" ]; then
invoke-rc.d maas-rackd start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start maas-rackd.service >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/bootresources.yaml 1.7.0~beta1+bzr2781-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/maas_local_celeryconfig_cluster.py 1.7.0~beta3+bzr3043-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/init/maas-cluster-celery.conf 1.7.0~beta3+bzr3043-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/init/maas-pserv.conf 1.7.0~beta3+bzr3043-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/init/maas-cluster.conf 1.7.0~beta6+bzr3231-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/init/maas-cluster-register.conf 1.7.0~beta6+bzr3231-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/maas-cluster-http.conf 1.8.0~alpha1+bzr3522-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/apc.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/mscm.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/msftocs.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/sm15k.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/ucsm.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/virsh.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/vmware.template 1.9.0~alpha1+bzr4184-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/ipmi.conf 1.9.0~alpha1+bzr4221-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/maas/templates/power/ipmi.template 1.9.0~alpha1+bzr4221-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/init/maas-clusterd.conf 2.0.0~alpha1+bzr4635-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /lib/systemd/system/maas-clusterd.service 2.0.0~alpha1+bzr4635-0ubuntu1 -- "$@"
# End automatically added section
|