From a23108f795075ea47bf206ff0fdad26c647d5a03 Mon Sep 17 00:00:00 2001 From: Hengyang Hu Date: Thu, 11 Aug 2016 16:20:37 -0700 Subject: [PATCH] None will not be added to grains which generate [none] --- salt/modules/grains.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/salt/modules/grains.py b/salt/modules/grains.py index 18a2c26512..4e8d4fcccb 100644 --- a/salt/modules/grains.py +++ b/salt/modules/grains.py @@ -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: