/usr/share/tripleo-image-elements/mysql-common/install.d/mysql-set-server-id.upstart is in python-tripleo-image-elements 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # vim: syntax=upstart
description "Set mysql server_id based on instance-id"
start on starting mysql
task
env INSTANCE_ID="/var/lib/cloud/data/instance-id"
env CONF_TARGET="/etc/mysql/conf.d/server_id.cnf"
pre-start script
if ! [ -e $INSTANCE_ID ] ; then
stop
exit 0
fi
end script
script
instance=$(cat $INSTANCE_ID)
server_id=$(python -c "print 0x${instance##i-}")
cat > $CONF_TARGET.new <<EOF
# Generated by mysql-set-server-id upstart job $(date)
# From $INSTANCE_ID ${instance}
[mysqld]
server_id = $server_id
EOF
mv -f $CONF_TARGET.new $CONF_TARGET
end script
|