def value_present(name, datastore, path, config):
 ret = {'name': name, 'result': False, 'changes': {}, 'comment': ''}
 existing = __salt__['cisconso.get_data'](datastore, path)
 if cmp(existing, config):
  ret['result'] = True
  ret['comment'] = 'Config is already set'
 elif (__opts__['test'] is True):
  ret['result'] = None
  ret['comment'] = 'Config will be added'
  diff = _DictDiffer(existing, config)
  ret['changes']['new'] = diff.added()
  ret['changes']['removed'] = diff.removed()
  ret['changes']['changed'] = diff.changed()
 else:
  __salt__['cisconso.set_data_value'](datastore, path, config)
  ret['result'] = True
  ret['comment'] = 'Successfully added config'
  diff = _DictDiffer(existing, config)
  ret['changes']['new'] = diff.added()
  ret['changes']['removed'] = diff.removed()
  ret['changes']['changed'] = diff.changed()
 return ret

def value_present ( name , datastore , path , config ) : ret = { 'name' : name , 'result' : False , 'changes' : { } , 'comment' : '' } existing = __salt__ [ 'cisconso.get_data' ] ( datastore , path ) if cmp ( existing , config ) : ret [ 'result' ] = True ret [ 'comment' ] = 'Config is already set' elif ( __opts__ [ 'test' ] is True ) : ret [ 'result' ] = None ret [ 'comment' ] = 'Config will be added' diff = _DictDiffer ( existing , config ) ret [ 'changes' ] [ 'new' ] = diff . added ( ) ret [ 'changes' ] [ 'removed' ] = diff . removed ( ) ret [ 'changes' ] [ 'changed' ] = diff . changed ( ) else : __salt__ [ 'cisconso.set_data_value' ] ( datastore , path , config ) ret [ 'result' ] = True ret [ 'comment' ] = 'Successfully added config' diff = _DictDiffer ( existing , config ) ret [ 'changes' ] [ 'new' ] = diff . added ( ) ret [ 'changes' ] [ 'removed' ] = diff . removed ( ) ret [ 'changes' ] [ 'changed' ] = diff . changed ( ) return ret
ensure a specific value exists at a given path .