In mysql module, I have this in the init.pp: exec { "create_mydb": command => "/usr/bin/mysql -u root -e \"CREATE DATABASE mydb; GRANT ALL PRIVILEGES ON mydb.* TO ''me''@''localhost'' IDENTIFIED BY ''mypw''; FLUSH PRIVILEGES\"", creates => "/var/lib/mysql/mydb/db.opt"; } When puppet runs, I get this error: err: //server/mysql/Exec[create_mydb]/returns: change from notrun to 0 failed: /usr/bin/mysql -u root -e "CREATE DATABASE mydb; GRANT ALL PRIVILEGES ON mydb.* TO ''me''@''localhost'' IDENTIFIED BY ''mypw''; FLUSH PRIVILEGES" returned 1 instead of 0 at /etc/puppet/modules/mysql/manifests/init.pp:22 I suspect it''s the quoting, but not sure. The error output seems to indicate that it got the quoting right. And when I copy and paste what it shows in the error output onto the command line, it works. The database is successfully created. Anyone know what the problem might be? Also, is there a better way of doing this? Thanks, johnn
On Jan 29, 2008, at 3:13 PM, Johnny Tan wrote:> I suspect it''s the quoting, but not sure. The error output > seems to indicate that it got the quoting right. And when I > copy and paste what it shows in the error output onto the > command line, it works. The database is successfully created. > > Anyone know what the problem might be? > Also, is there a better way of doing this?You could add ''logoutput => true'' to the exec, which should tell you what the command is saying. No guarantee it''ll be useful, but at least it won''t be my fault. :) You could also try alternating single and double quotes. -- Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it. -- Ellen DeGeneres --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Jan 29, 2008 12:22 AM, Luke Kanies <luke@madstop.com> wrote:> On Jan 29, 2008, at 3:13 PM, Johnny Tan wrote: > > > I suspect it''s the quoting, but not sure. The error output > > seems to indicate that it got the quoting right. And when I > > copy and paste what it shows in the error output onto the > > command line, it works. The database is successfully created. > > > > Anyone know what the problem might be? > > Also, is there a better way of doing this? > > > You could add ''logoutput => true'' to the exec, which should tell you > what the command is saying. No guarantee it''ll be useful, but at > least it won''t be my fault. :) > > You could also try alternating single and double quotes. >The logoutput didn''t give much hints. And the alternating single and double quotes didn''t work. However, I figured it out. It''s because the command was being run before mysqld service was started. So I had to add a require and now it works. Thanks Luke! johnn _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users