def cache_list(path=None, runas=None, env=None):
 env = (env or {})
 if runas:
  uid = salt.utils.get_uid(runas)
  if uid:
   env.update({'SUDO_UID': '{0}'.format(uid), 'SUDO_USER': ''})
 cmd = ['npm', 'cache', 'ls']
 if path:
  cmd.append(path)
 cmd = ' '.join(cmd)
 result = __salt__['cmd.run_all'](cmd, cwd=None, runas=runas, env=env, python_shell=True, ignore_retcode=True)
 if ((result['retcode'] != 0) and result['stderr']):
  raise CommandExecutionError(result['stderr'])
 return result['stdout']

def cache_list ( path = None , runas = None , env = None ) : env = ( env or { } ) if runas : uid = salt . utils . get_uid ( runas ) if uid : env . update ( { 'SUDO_UID' : '{0}' . format ( uid ) , 'SUDO_USER' : '' } ) cmd = [ 'npm' , 'cache' , 'ls' ] if path : cmd . append ( path ) cmd = ' ' . join ( cmd ) result = __salt__ [ 'cmd.run_all' ] ( cmd , cwd = None , runas = runas , env = env , python_shell = True , ignore_retcode = True ) if ( ( result [ 'retcode' ] != 0 ) and result [ 'stderr' ] ) : raise CommandExecutionError ( result [ 'stderr' ] ) return result [ 'stdout' ]
list npm cached packages .