def clean_fsbackend(opts):
 for backend in ('git', 'hg', 'svn'):
  if (backend in opts['fileserver_backend']):
   env_cache = os.path.join(opts['cachedir'], '{0}fs'.format(backend), 'envs.p')
   if os.path.isfile(env_cache):
    log.debug('Clearing {0}fs env cache'.format(backend))
    try:
     os.remove(env_cache)
    except OSError as exc:
     log.critical('Unable to clear env cache file {0}: {1}'.format(env_cache, exc))
   file_lists_dir = os.path.join(opts['cachedir'], 'file_lists', '{0}fs'.format(backend))
   try:
    file_lists_caches = os.listdir(file_lists_dir)
   except OSError:
    continue
   for file_lists_cache in fnmatch.filter(file_lists_caches, '*.p'):
    cache_file = os.path.join(file_lists_dir, file_lists_cache)
    try:
     os.remove(cache_file)
    except OSError as exc:
     log.critical('Unable to file_lists cache file {0}: {1}'.format(cache_file, exc))

def clean_fsbackend ( opts ) : for backend in ( 'git' , 'hg' , 'svn' ) : if ( backend in opts [ 'fileserver_backend' ] ) : env_cache = os . path . join ( opts [ 'cachedir' ] , '{0}fs' . format ( backend ) , 'envs.p' ) if os . path . isfile ( env_cache ) : log . debug ( 'Clearing {0}fs env cache' . format ( backend ) ) try : os . remove ( env_cache ) except OSError as exc : log . critical ( 'Unable to clear env cache file {0}: {1}' . format ( env_cache , exc ) ) file_lists_dir = os . path . join ( opts [ 'cachedir' ] , 'file_lists' , '{0}fs' . format ( backend ) ) try : file_lists_caches = os . listdir ( file_lists_dir ) except OSError : continue for file_lists_cache in fnmatch . filter ( file_lists_caches , '*.p' ) : cache_file = os . path . join ( file_lists_dir , file_lists_cache ) try : os . remove ( cache_file ) except OSError as exc : log . critical ( 'Unable to file_lists cache file {0}: {1}' . format ( cache_file , exc ) )
clean out the old fileserver backends .