Fixes #844 #5725 - correct hosts count in puppetclass

Make a separate method with an argument ```host_type``` and a clear title so you can call this query from all_hosts and all_hostgroups. I know what it does but it takes a few seconds to read.