<s> r'''<STR_LIT>''' <EOL> from __future__ import absolute_import , print_function <EOL> import logging <EOL> import os <EOL> import salt . output <EOL> import salt . utils <EOL> import salt . loader <EOL> import salt . template <EOL> from salt . exceptions import CommandExecutionError , SaltRenderError <EOL> from salt . runners . winrepo import ( <EOL> genrepo as _genrepo , <EOL> update_git_repos as _update_git_repos , <EOL> PER_REMOTE_OVERRIDES <EOL> ) <EOL> from salt . ext import six <EOL> try : <EOL> import msgpack <EOL> except ImportError : <EOL> import msgpack_pure as msgpack <EOL> import salt . utils . gitfs <EOL> log = logging . getLogger ( __name__ ) <EOL> __virtualname__ = '<STR_LIT>' <EOL> def __virtual__ ( ) : <EOL> '''<STR_LIT>''' <EOL> if salt . utils . is_windows ( ) : <EOL> global _genrepo , _update_git_repos <EOL> _genrepo = salt . utils . namespaced_function ( _genrepo , globals ( ) ) <EOL> _update_git_repos = salt . utils . namespaced_function ( _update_git_repos , globals ( ) ) <EOL> return __virtualname__ <EOL> return ( False , '<STR_LIT>' ) <EOL> def _get_local_repo_dir ( saltenv = '<STR_LIT>' ) : <EOL> if '<STR_LIT>' in __opts__ : <EOL> salt . utils . warn_until ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> winrepo_source_dir = __opts__ [ '<STR_LIT>' ] <EOL> else : <EOL> winrepo_source_dir = __opts__ [ '<STR_LIT>' ] <EOL> dirs = [ ] <EOL> dirs . append ( salt . syspaths . CACHE_DIR ) <EOL> dirs . extend ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> dirs . append ( saltenv ) <EOL> dirs . extend ( winrepo_source_dir [ <NUM_LIT:7> : ] . strip ( '<STR_LIT:/>' ) . split ( '<STR_LIT:/>' ) ) <EOL> return os . sep . join ( dirs ) <EOL> def genrepo ( ) : <EOL> r'''<STR_LIT>''' <EOL> return _genrepo ( opts = __opts__ , fire_event = False ) <EOL> def update_git_repos ( clean = False ) : <EOL> '''<STR_LIT>''' <EOL> if not salt . utils . which ( '<STR_LIT>' ) : <EOL> raise CommandExecutionError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> return _update_git_repos ( opts = __opts__ , clean = clean , masterless = True ) <EOL> def show_sls ( name , saltenv = '<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> repo = _get_local_repo_dir ( saltenv ) <EOL> repo = repo . split ( '<STR_LIT:\\>' ) <EOL> definition = name . split ( '<STR_LIT:.>' ) <EOL> repo . extend ( definition ) <EOL> sls_file = '<STR_LIT>' . format ( os . sep . join ( repo ) ) <EOL> if not os . path . exists ( sls_file ) : <EOL> sls_file = '<STR_LIT>' . format ( os . sep . join ( repo ) ) <EOL> if not os . path . exists ( sls_file ) : <EOL> return '<STR_LIT>' . format ( name ) <EOL> renderers = salt . loader . render ( __opts__ , __salt__ ) <EOL> config = { } <EOL> try : <EOL> config = salt . template . compile_template ( <EOL> sls_file , <EOL> renderers , <EOL> __opts__ [ '<STR_LIT>' ] ) <EOL> except SaltRenderError as exc : <EOL> log . debug ( '<STR_LIT>' . format ( sls_file ) ) <EOL> log . debug ( '<STR_LIT>' . format ( exc ) ) <EOL> config [ '<STR_LIT>' ] = '<STR_LIT>' . format ( sls_file ) <EOL> config [ '<STR_LIT>' ] = '<STR_LIT>' . format ( exc ) <EOL> return config </s>
