Hey Guys, I struggled with this for awhile as well.  I found what seems to 
alleviate this problem is if I specify a path to the .my.cnf file on the 
command line.  Something like this
        exec {'mysql_purge_testdb':
                command =>"mysql --defaults-file=/home/user/.my.cnf -e 
\"DROP DATABASE test_db\"",
                path    =>      "/usr/bin",
                cwd     =>      "/home/user",
                user    =>      "user"
        }


On Wednesday, July 20, 2011 at 2:27:58 PM UTC-7, newguy wrote:
>
> 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 <[email protected]> 
> 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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1c4e3cf0-a9e6-4b45-bf8d-2826e59175ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to