Merge pull request #39361 from gtmanfred/2016.11

make sure both variables are strings.
This commit is contained in:
Mike Place 2017-02-13 10:20:16 -07:00 committed by GitHub
commit a3a9a8e1ed

View file

@ -561,9 +561,9 @@ def filter_by(lookup_dict, grain='os_family', merge=None, default='default', bas
# Iterate over the list of grain values to match against patterns in the lookup_dict keys
for each in val if isinstance(val, list) else [val]:
for key in sorted(lookup_dict):
if key not in six.string_types:
key = str(key)
if fnmatch.fnmatchcase(each, key):
test_key = key if isinstance(key, six.string_types) else str(key)
test_each = each if isinstance(each, six.string_types) else str(each)
if fnmatch.fnmatchcase(test_each, test_key):
ret = lookup_dict[key]
break
if ret is not None: