Merge pull request #312 from apenney/fix-no-user

Previously we were matching to ensure that usernames matched
This commit is contained in:
Ashley Penney 2013-10-09 12:10:46 -07:00
commit 757d5ec204
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,5 @@
Puppet::Type.type(:mysql_user).provide(:mysql) do
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mysql'))
Puppet::Type.type(:mysql_user).provide(:mysql, :parent => Puppet::Provider::Mysql) do
desc 'manage users for a mysql database.'
commands :mysql => 'mysql'
@ -22,7 +23,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql) do
"SELECT CONCAT(User, '@',Host) AS User FROM mysql.user"].compact).split("\n")
# To reduce the number of calls to MySQL we collect all the properties in
# one big swoop.
users.select{ |user| user =~ /.+@/ }.collect do |name|
users.collect do |name|
query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, PASSWORD FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"
@max_user_connections, @max_connections_per_hour, @max_queries_per_hour,
@max_updates_per_hour, @password = mysql([defaults_file, "-NBe", query].compact).split(/\s/)

View file

@ -16,7 +16,7 @@ usvn_user@localhost
SQL_OUTPUT
end
let(:parsed_users) { %w(root@127.0.0.1 root@::1 debian-sys-maint@localhost root@localhost usvn_user@localhost) }
let(:parsed_users) { %w(root@127.0.0.1 root@::1 @localhost debian-sys-maint@localhost root@localhost usvn_user@localhost @vagrant-ubuntu-raring-64) }
let(:resource) { Puppet::Type.type(:mysql_user).new(
{ :ensure => :present,