changing the admin-admin_credentials results in failing puppet runs
mcrauwel opened this issue · comments
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 4.5.1
- Distribution: Any
- Module version: master
How to reproduce (e.g Puppet code you use)
class { '::proxysql':
listen_port => 3306,
admin_username => 'admin',
admin_password => '987654321',
...
}
What are you seeing
It changes the configfiles but not the running config so the 'admin' interface doesn't work anymore.
What behaviour did you expect instead
The running config should be updated also.
Output log
Notice: /Stage[main]/Proxysql::Config/File[proxysql-config-file]/content: content changed '{md5}1aa0b0ff694a7637ab19d056f2570f3b' to '{md5}3f789d32711f70a0de1bbb1020c43f27'
Notice: /Stage[main]/Proxysql::Config/File[root-mycnf-file]/content: content changed '{md5}a0022951a26962843d3b6145315614b1' to '{md5}373119578d26cb27679f5e28355c5c89'
Error: Failed to apply catalog: Execution of '/usr/bin/mysql --defaults-extra-file=/root/.my.cnf -NBe SELECT username FROM mysql_users' returned 1: ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin'@'' (using password: YES)
Got the "same" problem when changing interfaces:
mysql-interfaces | 0.0.0.0:3306;/tmp/proxysql.sock
Hiera:
'name': 'mysql-interfaces'
'value': '127.0.0.1:3306;/var/run/proxysql.sock'
Puppet module now: puppet change -> save to disk/load to runtime -> load to runtime fails
Right way in proxysql -> save to disk, restart proxysql (for mysql-interfaces, admin-mysql_ifaces, admin_credentials changes).
Quick/dirty fix:
Hiera:
'name': 'mysql-interfaces'
'value': '127.0.0.1:3306;/var/run/proxysql.sock'
'load_to_runtime': false
Restart proxysql manual.
I know! I have a fix in the pipeline for this... It is based on your quick/dirty fix. In config.pp I've added proxy_global_variable-resources admin-admin_credentials
and admin-mysql_interfaces
with load_to_runtime = false
. And I give these a notify => Service[proxysql]
and a before => File[root-my-cnf]
...
Adding mysql-mysql_interfaces is a good idea, the proxy does need a restart when changing the sockets / listen-ip I thought...
On second thought, changing the mysql-interfaces
does not break the admin interface or the puppet run... I try to avoid restarting the proxy daemon in an automated way as much as possible. If you want you can set the restart
option to true so any config change will trigger a proxysql restart (with --reload)...