<s> """<STR_LIT>""" <EOL> import logging <EOL> import os <EOL> import sys <EOL> from perfkitbenchmarker import events <EOL> from perfkitbenchmarker import flags <EOL> from perfkitbenchmarker import providers <EOL> from perfkitbenchmarker import vm_util <EOL> from perfkitbenchmarker . providers import azure <EOL> AZURE_PATH = '<STR_LIT>' <EOL> FLAGS = flags . FLAGS <EOL> _CLI_INSTALL_CMD = '<STR_LIT>' % azure . EXPECTED_CLI_VERSION <EOL> def _CheckAzureVersion ( ) : <EOL> """<STR_LIT>""" <EOL> version_cmd = [ AZURE_PATH , '<STR_LIT>' ] <EOL> try : <EOL> stdout , _ , retcode = vm_util . IssueCommand ( version_cmd ) <EOL> except OSError : <EOL> err_msg = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( install_cmd = _CLI_INSTALL_CMD , <EOL> sep = os . linesep ) ) <EOL> logging . debug ( err_msg , exc_info = True ) <EOL> sys . exit ( err_msg ) <EOL> if retcode : <EOL> logging . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , os . linesep , _CLI_INSTALL_CMD ) <EOL> sys . exit ( retcode ) <EOL> version = stdout . strip ( ) <EOL> if version != azure . EXPECTED_CLI_VERSION : <EOL> err_msg = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> expected = azure . EXPECTED_CLI_VERSION , install_cmd = _CLI_INSTALL_CMD , <EOL> installed = version , sep = os . linesep ) ) <EOL> if FLAGS . azure_ignore_cli_version : <EOL> logging . warning ( err_msg ) <EOL> else : <EOL> logging . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , err_msg , os . linesep ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> def _HandleProviderImported ( sender ) : <EOL> assert sender == providers . AZURE , sender <EOL> _CheckAzureVersion ( ) <EOL> events . provider_imported . connect ( _HandleProviderImported , providers . AZURE , <EOL> weak = False ) </s>
