Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Specifying SQL wildcard in mysql_host param causes failures #46

Closed
hundredacres opened this issue Mar 12, 2014 · 3 comments
Closed

Specifying SQL wildcard in mysql_host param causes failures #46

hundredacres opened this issue Mar 12, 2014 · 3 comments

Comments

@hundredacres
Copy link

When specifying '%' as the mysql_host, Puppet runs error out with the following -

Notice: /Stage[main]//Mysql::Grant[db1]/Mysql::Queryfile[mysql_db_init_query_file-%-db1]/Exec[mysqlqueryfile-mysql_db_init_query_file-%-db1]/returns: ERROR 2005 (HY000): Unknown MySQL server host '%' (0)
Error: mysql -u alpha --password="alpha" -h % db1 < /tmp/db1_init.sql && touch /root/puppet-mysql/mysqlqueryfile-mysql_db_init_query_file-%-db1.run returned 1 instead of one of [0]
Error: /Stage[main]//Mysql::Grant[db1]/Mysql::Queryfile[mysql_db_init_query_file-%-db1]/Exec[mysqlqueryfile-mysql_db_init_query_file-%-db1]/returns: change from notrun to 0 failed: mysql -u alpha --password="alpha" -h % db1 < /tmp/db1_init.sql && touch /root/puppet-mysql/mysqlqueryfile-mysql_db_init_query_file-%-db1.run returned 1 instead of one of [0]

I was able to work around this by making the following edits -

diff --git a/manifests/grant.pp b/manifests/grant.pp
index ce7ce2f..d286cc3 100644
--- a/manifests/grant.pp
+++ b/manifests/grant.pp
@@ -130,6 +130,7 @@ define mysql::grant (
mysql_password => $mysql_password,
mysql_db => $mysql_db,
mysql_host => $mysql_host,

  •  remote_host    => $remote_host,
    
    subscribe => Exec["mysqlgrant-${mysql_user}-${nice_mysql_host}-${dbname}"],
    }
    }
    diff --git a/manifests/queryfile.pp b/manifests/queryfile.pp
    index 01c585c..e42acad 100644
    --- a/manifests/queryfile.pp
    +++ b/manifests/queryfile.pp
    @@ -7,6 +7,7 @@ define mysql::queryfile (
    $mysql_password = '',
    $mysql_host = '',
    $mysql_query_filepath = '/root/puppet-mysql'
  • $remote_host = '',
    ) {

if ! defined(File[$mysql_query_filepath]) {
@@ -20,9 +21,9 @@ define mysql::queryfile (
default => "-u ${mysql_user}",
}

  • $arg_mysql_host = $mysql_host ? {
  • $arg_mysql_host = $remote_host ? {
    '' => '',
  • default => "-h ${mysql_host}",
  • default => "-h ${remote_host}",
    }

$arg_mysql_password = $mysql_password ? {

Not sure if this is a bug though, or just an edge case I've found?

@alvagante
Copy link
Member

Can you submit your change as pull request via GitHub (here is rather unreadable)

@hundredacres
Copy link
Author

Done.

Thanks.

On Mar 13, 2014, at 1:48 AM, Alessandro Franceschi [email protected] wrote:

Can you submit your change as pull request via GitHub (here is rather unreadable)


Reply to this email directly or view it on GitHub.

@lermit lermit closed this as completed in 57e93a4 Dec 29, 2014
@lermit
Copy link
Contributor

lermit commented Dec 29, 2014

Hi @hundredacres,

Thank you for the report. This is now patched.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants