def get_repo_data(saltenv=u'base'):
 repo_details = _get_repo_details(saltenv)
 if (repo_details.winrepo_age == (-1)):
  log.debug(u'No winrepo.p cache file. Refresh pkg db now.')
  refresh_db(saltenv=saltenv)
 if (u'winrepo.data' in __context__):
  log.trace(u'get_repo_data returning results from __context__')
  return __context__[u'winrepo.data']
 else:
  log.trace(u'get_repo_data called reading from disk')
 try:
  with salt.utils.fopen(repo_details.winrepo_file, u'rb') as repofile:
   try:
    repodata = (msgpack.loads(repofile.read()) or {})
    __context__[u'winrepo.data'] = repodata
    return repodata
   except Exception as exc:
    log.exception(exc)
    return {}
 except IOError as exc:
  log.error(u'Not able to read repo file')
  log.exception(exc)
  return {}

def get_repo_data ( saltenv = u'base' ) : repo_details = _get_repo_details ( saltenv ) if ( repo_details . winrepo_age == ( - 1 ) ) : log . debug ( u'No winrepo.p cache file. Refresh pkg db now.' ) refresh_db ( saltenv = saltenv ) if ( u'winrepo.data' in __context__ ) : log . trace ( u'get_repo_data returning results from __context__' ) return __context__ [ u'winrepo.data' ] else : log . trace ( u'get_repo_data called reading from disk' ) try : with salt . utils . fopen ( repo_details . winrepo_file , u'rb' ) as repofile : try : repodata = ( msgpack . loads ( repofile . read ( ) ) or { } ) __context__ [ u'winrepo.data' ] = repodata return repodata except Exception as exc : log . exception ( exc ) return { } except IOError as exc : log . error ( u'Not able to read repo file' ) log . exception ( exc ) return { }
returns the existing package meteadata db .