puppetlabs/puppetlabs-mysql — pull request #123 by hunner (2012-10-09 20:52:05+00:00)
Title: Root credentials

From #92:

The mysql root password is stored in `.my.cnf` in root's home directory. However, the `mysql` and `mysqladmin` commands use the value of the HOME environment variable rather than libc user ent data to determine the location of `.my.cnf`. This causes the puppet module's `mysql` and `mysqladmin` invocations to fail when HOME and the current user's home directory are not the same, e.g. if the puppet process was started using `sudo`.

I had created a pull request earlier and then got talked out of it. My initial discovery was that 'sudo puppet agent -t' failed but the running puppet daemon was able to apply the catalog. Someone suggested `sudo -i puppet agent -t` which works. I have since discovered that even restarting the agent daemon with sudo (`sudo /etc/init.d/puppet restart`) causes the a mismatch. This is much more insidious because the running daemon will fail on every run.