Fixes #2265 - Broken hosts_and_facts detection

Fixes this issue submitted by me:

http://projects.theforeman.org/issues/2265

Tested with Puppet master running Puppet 3.1.1.