It looks like it's the quotes in your command. The entire command is wrapped in 
double quotes, and the actual mysql command should be wrapped in single quotes, 
but isn't. Also you have admin, localhost, and secret in single quotes that 
aren't escaped. You will need to escape all the single quotes inside the mysql 
command, and also add an unescaped quote after the semicolon to match with the 
si glee quote after the '-e'. E.g.

command => "mysql -e 'grant all privileges on *.* to \'admin\'@\'localhost\' 
identified by \'secret\';'",

--
Peter

> On Feb 21, 2016, at 11:14 PM, Tim Dunphy <bluethu...@gmail.com> wrote:
> 
> Hey guys,
> 
>  I wrote an exec class for one of my modules. And for some reason, on puppet 
> runs it's not executing.
> 
> Here's the class:
> 
> class bacula::exec {
> 
>     exec { 'create.mysql.admin.user':
>     path => "/bin",
>     command => "mysql -e 'grant all privileges on *.* to 'admin'@'localhost' 
> identified by 'secret';",
>     refreshonly => true,
>     }
> 
> }
> 
> This is my init file:
> 
> class bacula {
> 
>     include bacula::install, bacula::service, bacula::cron, bacula::config, 
> bacula::exec
> 
> }
> 
> Any thoughts or opininions welcomed!
> 
> Tim
> 
> 
> -- 
> GPG me!!
> 
> gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/CAOZy0eky4KpzhZ4NS2BUQSSb7HK6L4HyEpPJAoRaaGK2dYW64w%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CEC4C999-D8D3-4134-8864-0C4B406793E3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to