#NEWLINE# @ transform_exception ( ex . RemoteCommandException , p_ex . ImageValidationError ) #NEWLINE# def validate( self , remote , reconcile = True , env_map = None , **kwargs ) : #NEWLINE# #INDENT# 'Attempts to validate the image.\n\n        Before deferring to contained validators, performs one-time setup\n        steps such as distro discovery.\n\n        :param remote: A remote socket to the instance.\n        :param reconcile: If false, all validators will only verify that a\n            desired state is present, and fail if it is not. If true, all\n            validators will attempt to enforce the desired state if possible,\n            and succeed if this enforcement succeeds.\n        :param env_map: A map of environment variables to pass to scripts.\n        :raises ImageValidationError: If validation fails.\n        ' #NEWLINE# env_map = ( copy . deepcopy ( env_map ) if env_map else { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# env_map [ self . RECONCILE_KEY ] = ( 1 if reconcile else 0 ) #NEWLINE# raw_distro = remote . execute_command ( 'lsb_release -is' ) #NEWLINE# distro = raw_distro [ 1 ] . strip ( ) . lower ( ) #NEWLINE# env_map [ self . DISTRO_KEY ] = distro #NEWLINE# self . validator . validate ( distro , reconcile = reconcile , env_map = env_map )