On Fri, Aug 10, 2012 at 08:51:33PM -0700, Mike Carr wrote: > I am looking to extend one of the puppet modules -"mysql". I found that they > are extending Puppet with types and providers. First off I am having a > difficult time find any documentationo on this and I do not know Ruby that > well. The problem that I am having is this, I have the following code: > > Puppet::Type.type(:database).provide(:mysql) do > desc "Manages MySQL database." > > defaultfor :kernel => 'Linux' > > optional_commands :mysql => 'mysql'
This will automatically define a method called mysql you can use later. > > def create > def create > mysql("-u #{resource[:rootuser]} -p\'#{resource[:rootpassword]}\' -h > #{resource[:host]} -NBev", "create database #{@resource[:name]} character set > #{resource[:charset]}") > end > The mysql method does not use a shell to execute your command, instead every argument you pass to the mysql method is passed as an argument to the mysql executable. So in your case mysql is only executed with one huge argument. What you want is: mysql( '-u', resource[:rootuser], '-p', resource[:rootpassword], '-h', resource[:host], '-NBev', "create database #{resource[:name]} character set #{resource[:charset]}" ) -Stefan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.