def genrepo(**kwargs):
 saltenv = kwargs.pop(u'saltenv', u'base')
 verbose = salt.utils.is_true(kwargs.pop(u'verbose', False))
 failhard = salt.utils.is_true(kwargs.pop(u'failhard', True))
 ret = {}
 successful_verbose = {}
 total_files_processed = 0
 ret[u'repo'] = {}
 ret[u'errors'] = {}
 repo_details = _get_repo_details(saltenv)
 for (root, _, files) in os.walk(repo_details.local_dest, followlinks=False):
  short_path = os.path.relpath(root, repo_details.local_dest)
  if (short_path == u'.'):
   short_path = u''
  for name in files:
   if name.endswith(u'.sls'):
    total_files_processed += 1
    _repo_process_pkg_sls(os.path.join(root, name), os.path.join(short_path, name), ret, successful_verbose)
 with salt.utils.fopen(repo_details.winrepo_file, u'w+b') as repo_cache:
  repo_cache.write(msgpack.dumps(ret))
 successful_count = len(successful_verbose)
 error_count = len(ret[u'errors'])
 if verbose:
  results = {u'total': total_files_processed, u'success': successful_count, u'failed': error_count, u'success_list': successful_verbose, u'failed_list': ret[u'errors']}
 elif (error_count > 0):
  results = {u'total': total_files_processed, u'success': successful_count, u'failed': error_count, u'failed_list': ret[u'errors']}
 else:
  results = {u'total': total_files_processed, u'success': successful_count, u'failed': error_count}
 if ((error_count > 0) and failhard):
  raise CommandExecutionError(u'Error occurred while generating repo db', info=results)
 else:
  return results

def genrepo ( ** kwargs ) : saltenv = kwargs . pop ( u'saltenv' , u'base' ) verbose = salt . utils . is_true ( kwargs . pop ( u'verbose' , False ) ) failhard = salt . utils . is_true ( kwargs . pop ( u'failhard' , True ) ) ret = { } successful_verbose = { } total_files_processed = 0 ret [ u'repo' ] = { } ret [ u'errors' ] = { } repo_details = _get_repo_details ( saltenv ) for ( root , _ , files ) in os . walk ( repo_details . local_dest , followlinks = False ) : short_path = os . path . relpath ( root , repo_details . local_dest ) if ( short_path == u'.' ) : short_path = u'' for name in files : if name . endswith ( u'.sls' ) : total_files_processed += 1 _repo_process_pkg_sls ( os . path . join ( root , name ) , os . path . join ( short_path , name ) , ret , successful_verbose ) with salt . utils . fopen ( repo_details . winrepo_file , u'w+b' ) as repo_cache : repo_cache . write ( msgpack . dumps ( ret ) ) successful_count = len ( successful_verbose ) error_count = len ( ret [ u'errors' ] ) if verbose : results = { u'total' : total_files_processed , u'success' : successful_count , u'failed' : error_count , u'success_list' : successful_verbose , u'failed_list' : ret [ u'errors' ] } elif ( error_count > 0 ) : results = { u'total' : total_files_processed , u'success' : successful_count , u'failed' : error_count , u'failed_list' : ret [ u'errors' ] } else : results = { u'total' : total_files_processed , u'success' : successful_count , u'failed' : error_count } if ( ( error_count > 0 ) and failhard ) : raise CommandExecutionError ( u'Error occurred while generating repo db' , info = results ) else : return results
generate winrepo_cachefile based on sls files in the winrepo_dir cli example: .