15472 - rewrite puppet agent

Fix error when trying to determine if a catalog is being applied