shell script behaving differently when executed through Puppet [closed]

asked 2017-03-13 06:28:11 -0500

I have following code, the script parsezd.sh is behaving differently when getting called through Puppet. Am i doing something wrong here? parsezd calls other shell scripts which are getting executed fine when parse_zd is called through normal ssh shell, but when called through puppet one of the sub scripts fails.

class ipc_zonedeployment::zd {

exec { 'deploy': command => '/bin/sh -c /opt/ipc/cop/tools/parse_zd.sh', cwd => '/opt/ipc/cop/tools/', onlyif => "test ! -f /etc/opt/ipc/deployment/zdd", path => ['/usr/bin', '/usr/sbin', '/bin',], user => 'root', group => 'root', mode => '0775',

}

package { 'test': ensure => installed, require => Exec['deploy'] }

}

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by mandar_ipc
close date 2017-03-13 12:51:18.199262

Comments

1

I would verify the user who should be executing these scripts is the same as the user running puppet. I would also imagine that environment variables could play a big part in the confusion here.

puser gravatar imagepuser ( 2017-03-13 12:33:01 -0500 )edit
1

I agree with Eric regarding environment variables. I've definitely had that bite me before. You'll have to track down which script is failing and why. Also, mode isn't a valid parameter on exec resources.

smarlow gravatar imagesmarlow ( 2017-03-13 12:45:04 -0500 )edit
1

Thanks guys, got it working. it was not getting path of java.

mandar_ipc gravatar imagemandar_ipc ( 2017-03-13 12:51:03 -0500 )edit