<s> from __future__ import print_function <EOL> from __future__ import absolute_import <EOL> from salt . utils import parsers <EOL> from salt . utils import activate_profile <EOL> from salt . utils import output_profile <EOL> from salt . utils . verify import check_user , verify_log <EOL> from salt . exceptions import SaltClientError <EOL> import salt . defaults . exitcodes <EOL> class SaltRun ( parsers . SaltRunOptionParser ) : <EOL> '''<STR_LIT>''' <EOL> def run ( self ) : <EOL> '''<STR_LIT>''' <EOL> import salt . runner <EOL> self . parse_args ( ) <EOL> self . setup_logfile_logger ( ) <EOL> verify_log ( self . config ) <EOL> profiling_enabled = self . options . profiling_enabled <EOL> runner = salt . runner . Runner ( self . config ) <EOL> if self . options . doc : <EOL> runner . print_docs ( ) <EOL> self . exit ( salt . defaults . exitcodes . EX_OK ) <EOL> try : <EOL> if check_user ( self . config [ '<STR_LIT:user>' ] ) : <EOL> pr = activate_profile ( profiling_enabled ) <EOL> try : <EOL> ret = runner . run ( ) <EOL> if isinstance ( ret , dict ) and '<STR_LIT>' in ret : <EOL> self . exit ( ret [ '<STR_LIT>' ] ) <EOL> finally : <EOL> output_profile ( <EOL> pr , <EOL> stats_path = self . options . profiling_path , <EOL> stop = True ) <EOL> except SaltClientError as exc : <EOL> raise SystemExit ( str ( exc ) ) </s>
