(#20137) Test for Puppet robustly

The test for puppet being present didn't seem to work when used in Rack
setups. I don't know why it didn't work there, however. This changes to
using "defined?" which is used in other parts of the puppet codebase and
appears to work in the way expected in Rack.
Merge pull request #125 from zaphod42/issue/1.x/not-detecting-puppet-correctly-in-rack

(#20137) Test for Puppet robustly