def unhold(name=None, pkgs=None, sources=None, **kwargs):
 _check_versionlock()
 if ((not name) and (not pkgs) and (not sources)):
  raise SaltInvocationError('One of name, pkgs, or sources must be specified.')
 if (pkgs and sources):
  raise SaltInvocationError('Only one of pkgs or sources can be specified.')
 targets = []
 if pkgs:
  for pkg in salt.utils.repack_dictlist(pkgs):
   targets.append(pkg)
 elif sources:
  for source in sources:
   targets.append(next(iter(source)))
 else:
  targets.append(name)
 current_locks = list_holds(full=(_yum() == 'yum'))
 ret = {}
 for target in targets:
  if isinstance(target, dict):
   target = next(six.iterkeys(target))
  ret[target] = {'name': target, 'changes': {}, 'result': False, 'comment': ''}
  if (_yum() == 'dnf'):
   search_locks = [x for x in current_locks if (x == target)]
  else:
   search_locks = [x for x in current_locks if (fnmatch.fnmatch(x, '*{0}*'.format(target)) and (target == _get_hold(x, full=False)))]
  if search_locks:
   if __opts__['test']:
    ret[target].update(result=None)
    ret[target]['comment'] = 'Package {0} is set to be unheld.'.format(target)
   else:
    out = __salt__['cmd.run_all'](([_yum(), 'versionlock', 'delete'] + search_locks), python_shell=False)
    if (out['retcode'] == 0):
     ret[target].update(result=True)
     ret[target]['comment'] = 'Package {0} is no longer held.'.format(target)
     ret[target]['changes']['new'] = ''
     ret[target]['changes']['old'] = 'hold'
    else:
     ret[target]['comment'] = 'Package {0} was unable to be unheld.'.format(target)
  else:
   ret[target].update(result=True)
   ret[target]['comment'] = 'Package {0} is not being held.'.format(target)
 return ret

def unhold ( name = None , pkgs = None , sources = None , ** kwargs ) : _check_versionlock ( ) if ( ( not name ) and ( not pkgs ) and ( not sources ) ) : raise SaltInvocationError ( 'One of name, pkgs, or sources must be specified.' ) if ( pkgs and sources ) : raise SaltInvocationError ( 'Only one of pkgs or sources can be specified.' ) targets = [ ] if pkgs : for pkg in salt . utils . repack_dictlist ( pkgs ) : targets . append ( pkg ) elif sources : for source in sources : targets . append ( next ( iter ( source ) ) ) else : targets . append ( name ) current_locks = list_holds ( full = ( _yum ( ) == 'yum' ) ) ret = { } for target in targets : if isinstance ( target , dict ) : target = next ( six . iterkeys ( target ) ) ret [ target ] = { 'name' : target , 'changes' : { } , 'result' : False , 'comment' : '' } if ( _yum ( ) == 'dnf' ) : search_locks = [ x for x in current_locks if ( x == target ) ] else : search_locks = [ x for x in current_locks if ( fnmatch . fnmatch ( x , '*{0}*' . format ( target ) ) and ( target == _get_hold ( x , full = False ) ) ) ] if search_locks : if __opts__ [ 'test' ] : ret [ target ] . update ( result = None ) ret [ target ] [ 'comment' ] = 'Package {0} is set to be unheld.' . format ( target ) else : out = __salt__ [ 'cmd.run_all' ] ( ( [ _yum ( ) , 'versionlock' , 'delete' ] + search_locks ) , python_shell = False ) if ( out [ 'retcode' ] == 0 ) : ret [ target ] . update ( result = True ) ret [ target ] [ 'comment' ] = 'Package {0} is no longer held.' . format ( target ) ret [ target ] [ 'changes' ] [ 'new' ] = '' ret [ target ] [ 'changes' ] [ 'old' ] = 'hold' else : ret [ target ] [ 'comment' ] = 'Package {0} was unable to be unheld.' . format ( target ) else : ret [ target ] . update ( result = True ) ret [ target ] [ 'comment' ] = 'Package {0} is not being held.' . format ( target ) return ret
set held message(s) in the mail queue to unheld cli example: .