Issue #11051 has been updated by Ken Barber.

Okay - gotcha.

So interestingly, the double backslashes actually work for me:

    $dbname = "foo-bar"

    exec { "database-${dbname}":
      command => "/usr/bin/mysql -uroot -pmyrootpassword -e \"create database 
\\`${dbname}\\`;\"",
      unless  => "/usr/bin/mysql -uroot -pmyrootpassword -e \"show databases\" 
|/bin/grep ^${dbname}$",
      logoutput => on_failure,
    } 

You say this returned some error?

Egon Kastelijn wrote:
> Hi Ken,
> 
> You are correct for 50% of the cases.
>  ;)
> 
> If your database names do not contain any '-' characters, then the backtick 
> are not needed.
> But if they do, then the database is not created when you omit the backticks.


----------------------------------------
Bug #11051: Unrecognised escape sequence '\`' in file (escaped backtick in 
manifest)
https://projects.puppetlabs.com/issues/11051

Author: Egon Kastelijn
Status: Investigating
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: puppet escape sequence backtick
Branch: 


We are developing MySQL recipes to make Puppet create and manage databases.

In order to create a MySQL database the database-name needs to be surrounded by 
backticks:

    exec { "database-${dbname}":
      command => "/usr/bin/mysql -uroot -p${mysql_password} -e \"create 
database \`${dbname}\`;\"",
      unless  => "/usr/bin/mysql -uroot -p${mysql_password} -e \"show 
databases\" |/bin/grep ^${dbname}$",
      require =>  Class["mysql::server"],
    } 

The catalogs runs fine, and the MySQL database is nicely created on the node.

The problem is that the PuppetMaster complains about an unrecognised escape 
sequence:

    Sat Nov 26 07:22:54 +0100 2011 Puppet (warning): Unrecognised escape 
sequence '\`' in file /etc/puppet/prod/modules/mysql/manifests/database.pp at 
line 15





-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to