(#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.