Instead of using backticks, please try and use one of the utility methods we have for executing commands.  `Puppet::Util::Execution.execute` for example.  This will provide debugging information automatically.

You can use the `generate` function as a reference: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/functions/generate.rb

-Jeff