def append(name, value, convert=False, delimiter=DEFAULT_TARGET_DELIM):
 name = re.sub(delimiter, DEFAULT_TARGET_DELIM, name)
 ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
 grain = __salt__['grains.get'](name, None)
 if grain:
  if isinstance(grain, list):
   if (value in grain):
    ret['comment'] = 'Value {1} is already in the list for grain {0}'.format(name, value)
    return ret
   if __opts__['test']:
    ret['result'] = None
    ret['comment'] = 'Value {1} in grain {0} is set to be added'.format(name, value)
    ret['changes'] = {'added': value}
    return ret
   __salt__['grains.append'](name, value)
   ret['comment'] = 'Value {1} was added to grain {0}'.format(name, value)
   ret['changes'] = {'added': value}
  elif (convert is True):
   if __opts__['test']:
    ret['result'] = None
    ret['comment'] = 'Grain {0} is set to be converted to list and value {1} will be added'.format(name, value)
    ret['changes'] = {'added': value}
    return ret
   grain = [grain]
   grain.append(value)
   __salt__['grains.setval'](name, grain)
   ret['comment'] = 'Value {1} was added to grain {0}'.format(name, value)
   ret['changes'] = {'added': value}
  else:
   ret['result'] = False
   ret['comment'] = 'Grain {0} is not a valid list'.format(name)
 else:
  ret['result'] = False
  ret['comment'] = 'Grain {0} does not exist'.format(name)
 return ret

def append ( name , value , convert = False , delimiter = DEFAULT_TARGET_DELIM ) : name = re . sub ( delimiter , DEFAULT_TARGET_DELIM , name ) ret = { 'name' : name , 'changes' : { } , 'result' : True , 'comment' : '' } grain = __salt__ [ 'grains.get' ] ( name , None ) if grain : if isinstance ( grain , list ) : if ( value in grain ) : ret [ 'comment' ] = 'Value {1} is already in the list for grain {0}' . format ( name , value ) return ret if __opts__ [ 'test' ] : ret [ 'result' ] = None ret [ 'comment' ] = 'Value {1} in grain {0} is set to be added' . format ( name , value ) ret [ 'changes' ] = { 'added' : value } return ret __salt__ [ 'grains.append' ] ( name , value ) ret [ 'comment' ] = 'Value {1} was added to grain {0}' . format ( name , value ) ret [ 'changes' ] = { 'added' : value } elif ( convert is True ) : if __opts__ [ 'test' ] : ret [ 'result' ] = None ret [ 'comment' ] = 'Grain {0} is set to be converted to list and value {1} will be added' . format ( name , value ) ret [ 'changes' ] = { 'added' : value } return ret grain = [ grain ] grain . append ( value ) __salt__ [ 'grains.setval' ] ( name , grain ) ret [ 'comment' ] = 'Value {1} was added to grain {0}' . format ( name , value ) ret [ 'changes' ] = { 'added' : value } else : ret [ 'result' ] = False ret [ 'comment' ] = 'Grain {0} is not a valid list' . format ( name ) else : ret [ 'result' ] = False ret [ 'comment' ] = 'Grain {0} does not exist' . format ( name ) return ret
append a to the list of the virtual ancestors .