0

I am executing a shell script in the puppet agent side. If I execute the same shell script in my local machine it will print several log messages to terminal. But when I execute it in the puppet agent it does not print any log into the agent terminal.

How can I print the logs of the shell script when I run it using puppet?

I am using following command to execute the shell script.

exec { "strating":
    user    => 'root',
    environment => 'JAVA_HOME=/home/malintha/jdk1.6.0',
    path        => $command_path,
    command => "/pathToShellScript/myScript.sh",
    logoutput => true,
    timeout => 3600,
    require => Exec['another goal'],
}

Note: I set logoutput => true

Felix Frank
  • 8,125
  • 1
  • 23
  • 30
Malintha
  • 4,512
  • 9
  • 48
  • 82

1 Answers1

0

You can add the --debug flag to the puppet command.

 puppet agent --test --debug

Or alternatively you can also set the loglevel metaparameter to info or notice:

 exec { 'starting':
   path      => $command_path,
   command   => '/path/to/script.sh',
   logoutput => true,
   loglevel  => info
 }

See the below output:

 [~]$ puppet apply --verbose test.pp
 Notice: Compiled catalog for dpsmqm009.local in environment production in 0.03 seconds
 Info: Applying configuration version '1403302144'
 Info: /Stage[main]/Main/Exec[starting]/returns: testing
 Info: /Stage[main]/Main/Exec[starting]/returns: testing again
 Info: /Stage[main]/Main/Exec[starting]/returns: testing some more
 Info: /Stage[main]/Main/Exec[starting]/returns: executed successfully
 Notice: Finished catalog run in 0.20 seconds

Reference

http://docs.puppetlabs.com/references/latest/metaparameter.html#loglevel

ptierno
  • 9,534
  • 2
  • 23
  • 35