Avoid key error in connected_ids()

Continue through the loop if we could't access the grains instead of
crashing and burning.

Closes #15143
Merge pull request #16890 from rallytime/bp-16798

Backport #16798 to 2014.7