Hi guys I am running in to a strange problem, I have a bunch of puppet modules and one of them has an exec which changes the root password and there is another which runs mysql import command to import dump file in to the database, the problem is both these exec are returning the following error: err: //par/Exec[root password]/returns: change from notrun to 0 failed: /usr/bin/mysqladmin -u root PASSWORD papa returned 1 instead of one of [0] at /etc/puppet/environments/development/modules/par/ manifests/init.pp:39 err: //par/Exec[Get db]/returns: change from notrun to 0 failed: /usr/ bin/mysql -uroot -ppapa par < download.sql returned 1 instead of one of [0] at /etc/puppet/environments/development/modules/par/manifests/ init.pp:35 but still once the catalog has finished I am able to access mysql through root password ring but there is no database par formed, i have checked the dump file its correct. I don''t know how to go about this, please help. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Here are my Execs, sorry didnt pasted them in the first post: exec {"Retrieve dump": cwd => "/var/www/r", command => "/usr/bin/wget http://xyz.com/asc.sql", timeout => 360, require=>Class[subversion], } exec {"Get db": cwd => "/var/www/r", command => "/usr/bin/mysql -uroot -ppapa < asc.sql", require =>Class[mysql], } MYSQL CLASS: class mysql { package { "mysql-server-5.1": ensure=>present, require=>Class[vim], } package {"mysql-client": ensure=>present, require=>Class[vim], } exec {"root password": command=>"/usr/bin/mysqladmin -u root PASSWORD papa", require=>package["mysql-server-5.1"], } } On Jul 20, 10:52 am, newguy <aimanparv...@gmail.com> wrote:> Hi guys > I am running in to a strange problem, I have a bunch of puppet > modules and one of them has an exec which changes the root password > and there is another which runs mysql import command to import dump > file in to the database, the problem is both these exec are returning > the following error: > > err: //par/Exec[root password]/returns: change from notrun to 0 > failed: /usr/bin/mysqladmin -u root PASSWORD papa returned 1 instead > of one of [0] at /etc/puppet/environments/development/modules/par/ > manifests/init.pp:39 > > err: //par/Exec[Get db]/returns: change from notrun to 0 failed: /usr/ > bin/mysql -uroot -ppapa par < download.sql returned 1 instead of one > of [0] at /etc/puppet/environments/development/modules/par/manifests/ > init.pp:35 > > but still once the catalog has finished I am able to access mysql > through root password ring but there is no database par formed, i have > checked the dump file its correct. > > I don''t know how to go about this, please help.-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Wed, Jul 20, 2011 at 2:00 PM, newguy <aimanparvaiz@gmail.com> wrote:> Here are my Execs, sorry didnt pasted them in the first post: > > exec {"Retrieve dump": > cwd => "/var/www/r", > command => "/usr/bin/wget http://xyz.com/asc.sql", > timeout => 360, > require=>Class[subversion], > } > > exec {"Get db": > cwd => "/var/www/r", > command => "/usr/bin/mysql -uroot -ppapa < asc.sql", > require =>Class[mysql], > } > > MYSQL CLASS: > class mysql { > package { "mysql-server-5.1": > ensure=>present, > require=>Class[vim], > } > > package {"mysql-client": > ensure=>present, > require=>Class[vim], > } > > exec {"root password": > command=>"/usr/bin/mysqladmin -u root PASSWORD papa", > require=>package["mysql-server-5.1"], > } > > } > > > > > > On Jul 20, 10:52 am, newguy <aimanparv...@gmail.com> wrote: >> Hi guys >> I am running in to a strange problem, I have a bunch of puppet >> modules and one of them has an exec which changes the root password >> and there is another which runs mysql import command to import dump >> file in to the database, the problem is both these exec are returning >> the following error: >> >> err: //par/Exec[root password]/returns: change from notrun to 0 >> failed: /usr/bin/mysqladmin -u root PASSWORD papa returned 1 instead >> of one of [0] at /etc/puppet/environments/development/modules/par/ >> manifests/init.pp:39 >> >> err: //par/Exec[Get db]/returns: change from notrun to 0 failed: /usr/ >> bin/mysql -uroot -ppapa par < download.sql returned 1 instead of one >> of [0] at /etc/puppet/environments/development/modules/par/manifests/ >> init.pp:35 >> >> but still once the catalog has finished I am able to access mysql >> through root password ring but there is no database par formed, i have >> checked the dump file its correct. >> >> I don''t know how to go about this, please help.Enable logoutput => on_failure.> -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Stefan Schulte
2011-Jul-20 19:57 UTC
Re: [Puppet Users] Re: mysql exec returning 1 instead of 0
On Wed, Jul 20, 2011 at 11:00:51AM -0700, newguy wrote:> Here are my Execs, sorry didnt pasted them in the first post: > > exec {"Retrieve dump": > cwd => "/var/www/r", > command => "/usr/bin/wget http://xyz.com/asc.sql", > timeout => 360, > require=>Class[subversion], > } > > exec {"Get db": > cwd => "/var/www/r", > command => "/usr/bin/mysql -uroot -ppapa < asc.sql", > require =>Class[mysql], > } > > MYSQL CLASS: > class mysql { > package { "mysql-server-5.1": > ensure=>present, > require=>Class[vim], > } > > package {"mysql-client": > ensure=>present, > require=>Class[vim], > } > > exec {"root password": > command=>"/usr/bin/mysqladmin -u root PASSWORD papa", > require=>package["mysql-server-5.1"], > } > > }Try to run the command on the command line and check the error code # /usr/bin/mysqladmin -u root PASSWORD papa # echo $? What is the output of both commands? Then you should read the manual what the returncode of 1 actually means. Normally a returncode that is not zero indicates an error and that is why puppet complains. If a returncode of 1 is actually expected when running mysqladmin you can specify your resource with the returns parameter[1] exec { ''root password'': command => ''/usr/bin/mysqladmin -u root PASSWORD papa'', returns => ''1'', # or even returns => [''0'',''1''] to allow both require => Package[''mysql-server-5.1''], } [1] http://docs.puppetlabs.com/references/stable/type.html#returns-1 -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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks Stefan, I tried executing the command from command line to realize that mysql dump contains bad data, thats why this problem is occurring, still have no clue about the mysqladmin command On Jul 20, 12:57 pm, Stefan Schulte <stefan.schu...@taunusstein.net> wrote:> On Wed, Jul 20, 2011 at 11:00:51AM -0700, newguy wrote: > > Here are my Execs, sorry didnt pasted them in the first post: > > > exec {"Retrieve dump": > > cwd => "/var/www/r", > > command => "/usr/bin/wgethttp://xyz.com/asc.sql", > > timeout => 360, > > require=>Class[subversion], > > } > > > exec {"Get db": > > cwd => "/var/www/r", > > command => "/usr/bin/mysql -uroot -ppapa < asc.sql", > > require =>Class[mysql], > > } > > > MYSQL CLASS: > > class mysql { > > package { "mysql-server-5.1": > > ensure=>present, > > require=>Class[vim], > > } > > > package {"mysql-client": > > ensure=>present, > > require=>Class[vim], > > } > > > exec {"root password": > > command=>"/usr/bin/mysqladmin -u root PASSWORD papa", > > require=>package["mysql-server-5.1"], > > } > > > } > > Try to run the command on the command line and check the error code > > # /usr/bin/mysqladmin -u root PASSWORD papa > # echo $? > > What is the output of both commands? Then you should read the manual > what the returncode of 1 actually means. Normally a returncode that is > not zero indicates an error and that is why puppet complains. If a > returncode of 1 is actually expected when running mysqladmin you can > specify your resource with the returns parameter[1] > > exec { ''root password'': > command => ''/usr/bin/mysqladmin -u root PASSWORD papa'', > returns => ''1'', # or even returns => [''0'',''1''] to allow both > require => Package[''mysql-server-5.1''], > } > > [1]http://docs.puppetlabs.com/references/stable/type.html#returns-1 > > -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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.