Properly handle the grains file

Fixes #672
Fixes saltstack/salt#5849
Fixes saltstack/salt-cloud#672
Refs saltstack/salt-bootstrap#175