Second attempt to fix #11453
Modify funcs with grains in pillar.
Merge pull request #11779 from cachedout/11453-1

Fix #11453