Fix Python 3 compatibility

In Python 3, dict.keys doesn't return a list, but a set-like object that represents a view of the dictionary's keys and doesn't support indexing. Formula therefor didn't worked with Python 3.
This commit is contained in:
Michal Hrušecký 2020-08-26 23:50:03 +02:00 committed by GitHub
parent bd859e07b7
commit c40f6198a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class GrainMaker:
def _parseGrainValues(self, grain):
# Parses individual grains and their values passed from the pillar
grainKey = grain.keys()[0]
grainKey = next(iter(grain.keys()))
if grain[grainKey]:
for value in grain[grainKey]:
self._addToGrains(grain, grainKey, value)