Skip to content

Commit

Permalink
Merge pull request #35407 from hu-dabao/fix-35094
Browse files Browse the repository at this point in the history
[Fix-35094] None will not be added to grains which generate [none]
  • Loading branch information
Mike Place committed Aug 12, 2016
2 parents 4dc776f + a23108f commit a5fe05b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions salt/modules/grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,9 @@ def append(key, val, convert=False, delimiter=DEFAULT_TARGET_DELIM):
salt '*' grains.append key val
'''
grains = get(key, [], delimiter)
if not isinstance(grains, list) and convert is True:
grains = [grains]
if convert:
if not isinstance(grains, list):
grains = [] if grains is None else [grains]
if not isinstance(grains, list):
return 'The key {0} is not a valid list'.format(key)
if val in grains:
Expand Down

0 comments on commit a5fe05b

Please sign in to comment.