Browse code

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

Ian Wienand authored on 2015/07/22 05:08:09
Showing 2 changed files
... ...
@@ -92,14 +92,12 @@ function configure_database_mysql {
92 92
 
93 93
     # Change bind-address from localhost (127.0.0.1) to any (::) and
94 94
     # set default db type to InnoDB
95
-    sudo bash -c "source $TOP_DIR/functions && \
96
-        iniset $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS" && \
97
-        iniset $my_conf mysqld sql_mode STRICT_ALL_TABLES && \
98
-        iniset $my_conf mysqld default-storage-engine InnoDB && \
99
-        iniset $my_conf mysqld max_connections 1024 && \
100
-        iniset $my_conf mysqld query_cache_type OFF && \
101
-        iniset $my_conf mysqld query_cache_size 0"
102
-
95
+    iniset -sudo $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS"
96
+    iniset -sudo $my_conf mysqld sql_mode STRICT_ALL_TABLES
97
+    iniset -sudo $my_conf mysqld default-storage-engine InnoDB
98
+    iniset -sudo $my_conf mysqld max_connections 1024
99
+    iniset -sudo $my_conf mysqld query_cache_type OFF
100
+    iniset -sudo $my_conf mysqld query_cache_size 0
103 101
 
104 102
     if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then
105 103
         echo_summary "Enabling MySQL query logging"
... ...
@@ -115,12 +113,10 @@ function configure_database_mysql {
115 115
 
116 116
         # Turn on slow query log, log all queries (any query taking longer than
117 117
         # 0 seconds) and log all non-indexed queries
118
-        sudo bash -c "source $TOP_DIR/functions && \
119
-            iniset $my_conf mysqld slow-query-log 1 && \
120
-            iniset $my_conf mysqld slow-query-log-file $slow_log && \
121
-            iniset $my_conf mysqld long-query-time 0 && \
122
-            iniset $my_conf mysqld log-queries-not-using-indexes 1"
123
-
118
+        iniset -sudo $my_conf mysqld slow-query-log 1
119
+        iniset -sudo $my_conf mysqld slow-query-log-file $slow_log
120
+        iniset -sudo $my_conf mysqld long-query-time 0
121
+        iniset -sudo $my_conf mysqld log-queries-not-using-indexes 1
124 122
     fi
125 123
 
126 124
     restart_service $mysql
... ...
@@ -546,7 +546,7 @@ function configure_tempest {
546 546
 
547 547
     if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
548 548
         # Use the ``BOTO_CONFIG`` environment variable to point to this file
549
-        iniset $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
549
+        iniset -sudo $BOTO_CONF Boto ca_certificates_file $SSL_BUNDLE_FILE
550 550
         sudo chown $STACK_USER $BOTO_CONF
551 551
     fi
552 552