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
This commit is contained in:
parent
7bde4efe1e
commit
cae3a3cbe8
3 changed files with 4 additions and 1 deletions
|
@ -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 &
|
||||
|
|
|
@ -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 &
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue