From 1d74db7df0f314703b73cde4acaed336d2b66e80 Mon Sep 17 00:00:00 2001 From: Ken Wronkiewicz Date: Mon, 6 Jun 2016 16:58:58 -0700 Subject: Config files having underscores breaks Kolla-Kubernetes. I just thought I'd dash off a quick patch and change the underscore to a dash. Change-Id: Ib34cfc8039de01be7e37176648482f9815ac3848 Closes-Bug: #1589734 --- ansible/roles/mariadb/tasks/config.yml | 6 +- ansible/roles/mariadb/templates/galera.cnf.j2 | 2 +- ansible/roles/mariadb/templates/mariadb.json.j2 | 4 +- ansible/roles/mariadb/templates/wsrep-notify.sh.j2 | 75 ++++++++++++++++++++++ ansible/roles/mariadb/templates/wsrep_notify.sh.j2 | 75 ---------------------- 5 files changed, 81 insertions(+), 81 deletions(-) create mode 100644 ansible/roles/mariadb/templates/wsrep-notify.sh.j2 delete mode 100644 ansible/roles/mariadb/templates/wsrep_notify.sh.j2 diff --git a/ansible/roles/mariadb/tasks/config.yml b/ansible/roles/mariadb/tasks/config.yml index 01a911905..a748c1adf 100644 --- a/ansible/roles/mariadb/tasks/config.yml +++ b/ansible/roles/mariadb/tasks/config.yml @@ -26,9 +26,9 @@ with_items: - "mariadb" -- name: Copying over wsrep_notify.sh +- name: Copying over wsrep-notify.sh template: - src: "{{ role_path }}/templates/wsrep_notify.sh.j2" - dest: "{{ node_config_directory }}/{{ item }}/wsrep_notify.sh" + src: "{{ role_path }}/templates/wsrep-notify.sh.j2" + dest: "{{ node_config_directory }}/{{ item }}/wsrep-notify.sh" with_items: - "mariadb" diff --git a/ansible/roles/mariadb/templates/galera.cnf.j2 b/ansible/roles/mariadb/templates/galera.cnf.j2 index 23919e2f3..7ffcb26a0 100644 --- a/ansible/roles/mariadb/templates/galera.cnf.j2 +++ b/ansible/roles/mariadb/templates/galera.cnf.j2 @@ -24,7 +24,7 @@ wsrep_node_name={{ ansible_hostname }} wsrep_sst_method=xtrabackup-v2 wsrep_sst_auth={{ database_user }}:{{ database_password }} wsrep_slave_threads=4 -wsrep_notify_cmd=/usr/local/bin/wsrep_notify.sh +wsrep_notify_cmd=/usr/local/bin/wsrep-notify.sh max_connections=10000 diff --git a/ansible/roles/mariadb/templates/mariadb.json.j2 b/ansible/roles/mariadb/templates/mariadb.json.j2 index d9c1c0b38..cfee62e4d 100644 --- a/ansible/roles/mariadb/templates/mariadb.json.j2 +++ b/ansible/roles/mariadb/templates/mariadb.json.j2 @@ -9,8 +9,8 @@ "perm": "0600" }, { - "source": "{{ container_config_directory }}/wsrep_notify.sh", - "dest": "/usr/local/bin/wsrep_notify.sh", + "source": "{{ container_config_directory }}/wsrep-notify.sh", + "dest": "/usr/local/bin/wsrep-notify.sh", "owner": "mysql", "perm": "0700" } diff --git a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 new file mode 100644 index 000000000..babd29e86 --- /dev/null +++ b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 @@ -0,0 +1,75 @@ +#!/bin/bash -e + +# Edit parameters below to specify the address and login to server. +USER={{ database_user }} +PSWD={{ database_password }} +HOST={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} +PORT={{ mariadb_port }} +LB_USER=haproxy + +ENABLE_LB="UPDATE mysql.user SET User='${LB_USER}' WHERE User='${LB_USER}_blocked';" +DISABLE_LB="UPDATE mysql.user SET User='${LB_USER}_blocked' WHERE User='${LB_USER}';" +MYSQL_CMD="`type -p mysql` -B -u$USER -p$PSWD -h$HOST -P$PORT" + +status_update() +{ + echo "SET SESSION wsrep_on=off;" + echo "$@" + echo "FLUSH PRIVILEGES;" +} + +get_sst_method() +{ + $MYSQL_CMD -s -N -e "SHOW VARIABLES LIKE 'wsrep_sst_method';" | awk '{ print $2 }' +} + +while [ $# -gt 0 ] +do + case $1 in + --status) + STATUS=$2 + shift + ;; + --uuid) + CLUSTER_UUID=$2 + shift + ;; + --primary) + [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0" + shift + ;; + --index) + INDEX=$2 + shift + ;; + --members) + MEMBERS=$2 + shift + ;; + esac + shift +done + +case $STATUS in +Synced) + CMD=$ENABLE_LB + ;; +Donor) + # enabling donor only if xtrabackup configured + SST_METHOD=`get_sst_method` + [[ $SST_METHOD =~ 'xtrabackup' ]] && CMD=$ENABLE_LB || CMD=$DISABLE_LB + ;; +Undefined) + # shutting down database: do nothing + ;; +*) + CMD=$DISABLE_LB + ;; +esac + +if [ -n "$CMD" ] +then + status_update "$CMD" | $MYSQL_CMD +fi + +exit 0 diff --git a/ansible/roles/mariadb/templates/wsrep_notify.sh.j2 b/ansible/roles/mariadb/templates/wsrep_notify.sh.j2 deleted file mode 100644 index babd29e86..000000000 --- a/ansible/roles/mariadb/templates/wsrep_notify.sh.j2 +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -e - -# Edit parameters below to specify the address and login to server. -USER={{ database_user }} -PSWD={{ database_password }} -HOST={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -PORT={{ mariadb_port }} -LB_USER=haproxy - -ENABLE_LB="UPDATE mysql.user SET User='${LB_USER}' WHERE User='${LB_USER}_blocked';" -DISABLE_LB="UPDATE mysql.user SET User='${LB_USER}_blocked' WHERE User='${LB_USER}';" -MYSQL_CMD="`type -p mysql` -B -u$USER -p$PSWD -h$HOST -P$PORT" - -status_update() -{ - echo "SET SESSION wsrep_on=off;" - echo "$@" - echo "FLUSH PRIVILEGES;" -} - -get_sst_method() -{ - $MYSQL_CMD -s -N -e "SHOW VARIABLES LIKE 'wsrep_sst_method';" | awk '{ print $2 }' -} - -while [ $# -gt 0 ] -do - case $1 in - --status) - STATUS=$2 - shift - ;; - --uuid) - CLUSTER_UUID=$2 - shift - ;; - --primary) - [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0" - shift - ;; - --index) - INDEX=$2 - shift - ;; - --members) - MEMBERS=$2 - shift - ;; - esac - shift -done - -case $STATUS in -Synced) - CMD=$ENABLE_LB - ;; -Donor) - # enabling donor only if xtrabackup configured - SST_METHOD=`get_sst_method` - [[ $SST_METHOD =~ 'xtrabackup' ]] && CMD=$ENABLE_LB || CMD=$DISABLE_LB - ;; -Undefined) - # shutting down database: do nothing - ;; -*) - CMD=$DISABLE_LB - ;; -esac - -if [ -n "$CMD" ] -then - status_update "$CMD" | $MYSQL_CMD -fi - -exit 0 -- cgit v1.2.3