Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Thanks much Nathan, it worked like a charm. :) Thank you Peter and Luke; keep up the good work. Regards, A. On Fri, Jun 17, 2011 at 6:50 PM, Nathan Clemons wrote: > You want: > > file { "blah": > ... > } > exec {"blah2": > ... > require => File['blah'] > } > > That way you ensure the file

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Nathan Clemons
You want: file { "blah": ... } exec {"blah2": ... require => File['blah'] } That way you ensure the file is created before you try to run the exec. -- Nathan Clemons http://www.livemocha.com The worlds largest online language learning community On Fri, Jun 17, 2011 at 10:43 AM, Annie Ra

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Hi, Thanks much for help. Some how I managed to execute the original shell script using command in exec "command=>'sh /tmp/QoS/QoS.sh'" and I used path parameter as well "path=>'/sbin:/sbin/ipatbles:/bin:/usr/bin'" but I have to run file and exec recipes separately one after another otherwise exec

[Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Luke Bigum
Wouldn't have worked anyway, change "print" to "echo" and I forgot #!/ bin/bash... That's what I get for writing code from memory ;) That's strange, I just put this in my Puppet server: node 'puppetmaster' { file { '/etc/shell_file': ensure => present, owner => 'root', group => 'roo

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Hi Luke, I replaced my shell script with the one you wrote. Same old error message appeared again 'change from notrun to 0 failed: /tmp/QoS/QoS.sh returned 1 instead of o at /etc/puppet/manifests/site.pp' . Your script didn't generate any log at client machine. Now I am sure about one thing that t

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Hi Luke, I replaced my shell script with the one you wrote. Same old error message appeared again 'change from notrun to 0 failed: /tmp/QoS/QoS.sh returned 1 instead of o at /etc/puppet/manifests/site.pp'. Your script didn't generated any log at client machine. Now I am sure about one thing that t

[Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Luke Bigum
I'm out of ideas and I'd resort to hacking the script a bit to get some debugging output. Try just this in QoS.sh to try identify what's failing: export LAN=eth1 export WAN=eth0 CMD="tc filter add dev ${WAN} parent 1:0 prio 4 protocol ip u32 match ip tos 0x880xff classid 1:12" OUT=$($CMD) > /tmp/Q

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Thanks again Peter but sorry it didn't work out either. On Fri, Jun 17, 2011 at 3:52 PM, Peter Bukowinski wrote: > In your QoS.sh file, make sure to use explicit paths to executables, e.g: > > use '/sbin/iptables -blah …' NOT 'iptables -blah …' > > > -- > Peter M. Bukowinski > Systems Engineer >

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Peter Bukowinski
In your QoS.sh file, make sure to use explicit paths to executables, e.g: use '/sbin/iptables -blah …' NOT 'iptables -blah …' -- Peter M. Bukowinski Systems Engineer Janelia Farm Research Campus, HHMI On Friday, June 17, 2011 at 10:44 AM, Annie Rana wrote: > Hi Luke, > What's your shell scri

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Here is site.pp == file {"/tmp/QoS/QoS.sh": ensure =>present, owner=>'root', group=>'root', mode=>'777', source=>'puppet://puppet/files/QoS.sh', } exec {"/tmp/QoS/QoS.sh": require=>File['/tmp/QoS/QoS.sh'], } Here is the QoS.sh Script

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Hi Luke, What's your shell script expected to do? The shell script would generate Iptables rules How do you know it didn't work? I can check using ipatbles -L or iptables -t mangle -L commands If you run it by hand in a root shell, does it work then? Yes If so, there might be an environment pro

[Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Luke Bigum
How do you know it didn't work? What's your shell script expected to do? If you run it by hand in a root shell, does it work then? If so, there might be an environment problem when running from Puppet, like $PATH or something. Try set the parameter "logoutput => true" in the exec resource. On Jun

Re: [Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Annie Rana
Thanks but it couldn't work though i got the message that shell script is successfully executed. On Fri, Jun 17, 2011 at 2:44 PM, Luke Bigum wrote: > Annie, > > http://docs.puppetlabs.com/references/stable/type.html#exec > > By default the expected return code is probably zero, your script is >

[Puppet Users] Re: Puppet recipe to copy and execute a shell file

2011-06-17 Thread Luke Bigum
Annie, http://docs.puppetlabs.com/references/stable/type.html#exec By default the expected return code is probably zero, your script is returning 1. Whether this is correct or not I don't know, but you can tell puppet to expect a different return code: exec { '/etc/shell_file': require => File