Merge pull request #31527 from Ashald/bugfix/consul-pillar-empty-keys

Consul Pillar: don't crash on empty values
This commit is contained in:
Mike Place 2016-02-29 09:04:33 -07:00
commit 01c9550953

View File

@ -208,11 +208,13 @@ def pillar_format(ret, keys, value):
Perform data formatting to be used as pillar data and
merge it with the current pillar data
'''
# drop leading/trailing whitespace, if any
value = value.strip(' \t\n\r')
# skip it
# if value is empty in Consul then it's None here - skip it
if value is None:
return ret
# drop leading/trailing whitespace, if any
value = value.strip(' \t\n\r')
# if wrapped in quotes, drop them
if value[0] == value[-1] == '"':
pillar_value = value[1:-1]