diff options
author | mh <mh@immerda.ch> | 2014-02-05 22:34:17 +0100 |
---|---|---|
committer | mh <mh@immerda.ch> | 2014-02-05 22:34:17 +0100 |
commit | cae3a3cbe85d1dffcd7a7a964669d2b758561dc0 (patch) | |
tree | da52f5ed67f588f176f46ecfc0b8e956ba73bbd1 | |
parent | 7bde4efe1e680d21dfa8ecd15e5e9a3c5eb41df2 (diff) |
fix #6638 - remove the unless check & improve script
To workaround a limitation of the exec provider within puppet, we
do the unless check no within the script itself and ensure that
we use the password there.
https://labs.riseup.net/code/issues/6638
-rw-r--r-- | files/scripts/CentOS/setmysqlpass.sh | 2 | ||||
-rw-r--r-- | files/scripts/Debian/setmysqlpass.sh | 2 | ||||
-rw-r--r-- | manifests/server/base.pp | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/files/scripts/CentOS/setmysqlpass.sh b/files/scripts/CentOS/setmysqlpass.sh index 870494c..8b468e1 100644 --- a/files/scripts/CentOS/setmysqlpass.sh +++ b/files/scripts/CentOS/setmysqlpass.sh @@ -4,6 +4,8 @@ test -f /root/.my.cnf || exit 1 rootpw=$(grep password /root/.my.cnf | sed -e 's/^[^=]*= *\(.*\) */\1/') +/usr/bin/mysqladmin -uroot --password="${rootpw}" status > /dev/null && echo "Nothing to do as the password already works" && exit 0 + /sbin/service mysqld stop /usr/libexec/mysqld --skip-grant-tables --user=root --datadir=/var/lib/mysql/data --log-bin=/var/lib/mysql/mysql-bin & diff --git a/files/scripts/Debian/setmysqlpass.sh b/files/scripts/Debian/setmysqlpass.sh index 1ef4aaa..ec2c971 100644 --- a/files/scripts/Debian/setmysqlpass.sh +++ b/files/scripts/Debian/setmysqlpass.sh @@ -4,6 +4,8 @@ test -f /root/.my.cnf || exit 1 rootpw=$(grep password /root/.my.cnf | sed -e 's/^[^=]*= *\(.*\) */\1/') +/usr/bin/mysqladmin -uroot --password="${rootpw}" status > /dev/null && echo "Nothing to do as the password already works" && exit 0 + /etc/init.d/mysql stop /usr/sbin/mysqld --skip-grant-tables --user=root --datadir=/var/lib/mysql --log-bin=/var/lib/mysql/mysql-bin & diff --git a/manifests/server/base.pp b/manifests/server/base.pp index da82e2f..2d55605 100644 --- a/manifests/server/base.pp +++ b/manifests/server/base.pp @@ -50,7 +50,6 @@ class mysql::server::base { exec { 'mysql_set_rootpw': command => '/usr/local/sbin/setmysqlpass.sh', - unless => 'mysqladmin -uroot status > /dev/null', require => [ File['mysql_setmysqlpass.sh'], Service['mysql'] ], # this is for security so that we only change the password # if the password file itself has changed |