Fix traceback when generating BSD grains

This fixes a traceback introduced in e72876b which causes grain
compilation to be incomplete. Fixes #6407.
Merge pull request #6413 from terminalmage/issue6407

Fix traceback when generating BSD grains