<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import , print_function <EOL> import errno <EOL> import logging <EOL> import os <EOL> import salt . utils <EOL> from salt . ext import six <EOL> log = logging . getLogger ( __name__ ) <EOL> def _get_missing_results ( results , dest_dir ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> present = set ( os . listdir ( dest_dir ) ) <EOL> except OSError as exc : <EOL> if exc . errno == errno . ENOENT : <EOL> log . debug ( <EOL> '<STR_LIT>' <EOL> . format ( dest_dir ) <EOL> ) <EOL> elif exc . errno == errno . EACCES : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> . format ( dest_dir ) <EOL> ) <EOL> present = set ( ) <EOL> return sorted ( set ( results ) . difference ( present ) ) <EOL> def built ( name , <EOL> runas , <EOL> dest_dir , <EOL> spec , <EOL> sources , <EOL> tgt , <EOL> template = None , <EOL> deps = None , <EOL> env = None , <EOL> results = None , <EOL> force = False , <EOL> always = None , <EOL> saltenv = '<STR_LIT>' , <EOL> log_dir = '<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:result>' : True } <EOL> if always is not None : <EOL> salt . utils . warn_until ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> force = always <EOL> if not results : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> return ret <EOL> if isinstance ( results , six . string_types ) : <EOL> results = results . split ( '<STR_LIT:U+002C>' ) <EOL> needed = _get_missing_results ( results , dest_dir ) <EOL> if not force and not needed : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> if force : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT:U+002CU+0020>' . join ( needed ) <EOL> return ret <EOL> if env is not None and not isinstance ( env , dict ) : <EOL> ret [ '<STR_LIT>' ] = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> return ret <EOL> ret [ '<STR_LIT>' ] = __salt__ [ '<STR_LIT>' ] ( <EOL> runas , <EOL> tgt , <EOL> dest_dir , <EOL> spec , <EOL> sources , <EOL> deps , <EOL> env , <EOL> template , <EOL> saltenv , <EOL> log_dir ) <EOL> needed = _get_missing_results ( results , dest_dir ) <EOL> if needed : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT:U+002CU+0020>' . join ( needed ) <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> def repo ( name , keyid = None , env = None ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:result>' : True } <EOL> if __opts__ [ '<STR_LIT:test>' ] is True : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> return ret <EOL> if env is not None and not isinstance ( env , dict ) : <EOL> ret [ '<STR_LIT>' ] = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> return ret <EOL> __salt__ [ '<STR_LIT>' ] ( name , keyid , env ) <EOL> ret [ '<STR_LIT>' ] = { '<STR_LIT>' : True } <EOL> return ret </s>
