Added function to query puppetdb