Use sudo iniset to modify /etc files

The existing mysql code is wrong and not detected as failing [1], and
boto config requires work-arounds [2,3] that are all fairly ugly.  Use
-sudo argument to iniset to handle this.

[1] I24388b5de777995f92d73076524122cf599d6371
[2] I5f4c43bbbe477c570936e2e40ac05cc38febbb3f
[3] Ib7556dac9aaaf2f3c96237e0ca28ed6ae1b1b7ac

Change-Id: Iaceb8d42ce37be728adae6fd0a30a1f9d33d4029
This commit is contained in:
Ian Wienand 2015-07-22 06:08:09 +10:00
parent 9f52d648fb
commit 9c0b9f3024
2 changed files with 11 additions and 15 deletions

View File

@ -92,14 +92,12 @@ function configure_database_mysql {
# Change bind-address from localhost (127.0.0.1) to any (::) and # Change bind-address from localhost (127.0.0.1) to any (::) and
# set default db type to InnoDB # set default db type to InnoDB
sudo bash -c "source $TOP_DIR/functions && \ iniset -sudo $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS"
iniset $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS" && \ iniset -sudo $my_conf mysqld sql_mode STRICT_ALL_TABLES
iniset $my_conf mysqld sql_mode STRICT_ALL_TABLES && \ iniset -sudo $my_conf mysqld default-storage-engine InnoDB
iniset $my_conf mysqld default-storage-engine InnoDB && \ iniset -sudo $my_conf mysqld max_connections 1024
iniset $my_conf mysqld max_connections 1024 && \ iniset -sudo $my_conf mysqld query_cache_type OFF
iniset $my_conf mysqld query_cache_type OFF && \ iniset -sudo $my_conf mysqld query_cache_size 0
iniset $my_conf mysqld query_cache_size 0"
if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then
echo_summary "Enabling MySQL query logging" echo_summary "Enabling MySQL query logging"
@ -115,12 +113,10 @@ function configure_database_mysql {
# Turn on slow query log, log all queries (any query taking longer than # Turn on slow query log, log all queries (any query taking longer than
# 0 seconds) and log all non-indexed queries # 0 seconds) and log all non-indexed queries
sudo bash -c "source $TOP_DIR/functions && \ iniset -sudo $my_conf mysqld slow-query-log 1
iniset $my_conf mysqld slow-query-log 1 && \ iniset -sudo $my_conf mysqld slow-query-log-file $slow_log
iniset $my_conf mysqld slow-query-log-file $slow_log && \ iniset -sudo $my_conf mysqld long-query-time 0
iniset $my_conf mysqld long-query-time 0 && \ iniset -sudo $my_conf mysqld log-queries-not-using-indexes 1
iniset $my_conf mysqld log-queries-not-using-indexes 1"
fi fi
restart_service $mysql restart_service $mysql

View File

@ -546,7 +546,7 @@ function configure_tempest {
if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
# Use the ``BOTO_CONFIG`` environment variable to point to this file # Use the ``BOTO_CONFIG`` environment variable to point to this file
iniset $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE iniset -sudo $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
sudo chown $STACK_USER $BOTO_CONF sudo chown $STACK_USER $BOTO_CONF
fi fi