def add_lock(packages, **kwargs):
 locks = list_locks()
 added = []
 try:
  packages = list(__salt__['pkg_resource.parse_targets'](packages)[0].keys())
 except MinionError as exc:
  raise CommandExecutionError(exc)
 for pkg in packages:
  if (not locks.get(pkg)):
   added.append(pkg)
 if added:
  __zypper__.call('al', *added)
 return {'added': len(added), 'packages': added}

def add_lock ( packages , ** kwargs ) : locks = list_locks ( ) added = [ ] try : packages = list ( __salt__ [ 'pkg_resource.parse_targets' ] ( packages ) [ 0 ] . keys ( ) ) except MinionError as exc : raise CommandExecutionError ( exc ) for pkg in packages : if ( not locks . get ( pkg ) ) : added . append ( pkg ) if added : __zypper__ . call ( 'al' , * added ) return { 'added' : len ( added ) , 'packages' : added }
add a package lock .