COOK-2558: Don't fail to write out services in the hostgroups databags

Fix the logic for checking for valid host groups