def cache_file(path, saltenv='base'):
 contextkey = '{0}_|-{1}_|-{2}'.format('cp.cache_file', path, saltenv)
 path_is_remote = (_urlparse(path).scheme in ('http', 'https', 'ftp'))
 try:
  if (path_is_remote and (contextkey in __context__)):
   if os.path.isfile(__context__[contextkey]):
    return __context__[contextkey]
   else:
    __context__.pop(contextkey)
 except AttributeError:
  pass
 (path, senv) = salt.utils.url.split_env(path)
 if senv:
  saltenv = senv
 result = _client().cache_file(path, saltenv)
 if (not result):
  log.error("Unable to cache file '{0}' from saltenv '{1}'.".format(path, saltenv))
 if path_is_remote:
  __context__[contextkey] = result
 return result

def cache_file ( path , saltenv = 'base' ) : contextkey = '{0}_|-{1}_|-{2}' . format ( 'cp.cache_file' , path , saltenv ) path_is_remote = ( _urlparse ( path ) . scheme in ( 'http' , 'https' , 'ftp' ) ) try : if ( path_is_remote and ( contextkey in __context__ ) ) : if os . path . isfile ( __context__ [ contextkey ] ) : return __context__ [ contextkey ] else : __context__ . pop ( contextkey ) except AttributeError : pass ( path , senv ) = salt . utils . url . split_env ( path ) if senv : saltenv = senv result = _client ( ) . cache_file ( path , saltenv ) if ( not result ) : log . error ( "Unable to cache file '{0}' from saltenv '{1}'." . format ( path , saltenv ) ) if path_is_remote : __context__ [ contextkey ] = result return result
wrapper for cp .