0001 $ ˆl–ß=¿J ClÊq@;q§.*bÑ¿Æ „[ŸÅÀÃ,ò a ì)g99ã@sddlmZmZmZeZddlZddlZddlm Z ddl m Z m Z m Z mZmZmZmZmZddlmZmZGdd„deƒZGdd „d eeƒZGd d „d eƒZGd d „d eƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZ Gdd„deƒZ!Gdd„deƒZ"Gdd„de"ƒZ#Gdd„de"ƒZ$Gd d!„d!e"ƒZ%Gd"d#„d#eƒZ&Gd$d%„d%eƒZ'Gd&d'„d'e'ƒZ(Gd(d)„d)e'ƒZ)Gd*d+„d+e'ƒZ*Gd,d-„d-eƒZ+Gd.d/„d/e+ƒZ,Gd0d1„d1e+ƒZ-Gd2d3„d3e+ƒZ.Gd4d5„d5e"e/ƒZ0Gd6d7„d7e+ƒZ1dS)8é)Úabsolute_importÚdivisionÚprint_functionN)ÚSequence)ÚYAML_COMMON_DICT_ERRORÚYAML_COMMON_LEADING_TAB_ERRORÚ'YAML_COMMON_PARTIALLY_QUOTED_LINE_ERRORÚ#YAML_COMMON_UNBALANCED_QUOTES_ERRORÚ YAML_COMMON_UNQUOTED_COLON_ERRORÚ#YAML_COMMON_UNQUOTED_VARIABLE_ERRORÚYAML_POSITION_DETAILSÚYAML_AND_SHORTHAND_ERROR)Ú to_nativeÚto_textcs\eZdZdZd‡fdd„ Zedd „ƒZejd d „ƒZd d „Zd d„Z dd„Z dd„Z ‡Z S)Ú AnsibleErrora This is the base class for all errors raised from Ansible code, and can be instantiated with two optional parameters beyond the error message to control whether detailed information is displayed when the error occurred while parsing a data file of some kind. Usage: raise AnsibleError('some message here', obj=obj, show_content=True) Where "obj" is some subclass of ansible.parsing.yaml.objects.AnsibleBaseYAMLObject, which should be returned by the DataLoader() class. ÚNTFcs6tt|ƒ |¡||_||_t|ƒ|_||_||_dS©N) ÚsuperrÚ__init__Ú _show_contentÚ_suppress_extended_errorrÚ_messageÚobjÚorig_exc)ÚselfÚmessagerÚ show_contentÚsuppress_extended_errorr©Ú __class__©ú;/usr/lib/python3.9/site-packages/ansible/errors/__init__.pyr7s  zAnsibleError.__init__cCsjddlm}|jg}t|j|ƒrF| ¡}|r`|js`| dt|ƒ¡n|j r`| dt|j ƒ¡d  |¡S)Nr)ÚAnsibleBaseYAMLObjectz %sz. %sr) Zansible.parsing.yaml.objectsr"rÚ isinstancerÚ_get_extended_errorrÚappendrrÚjoin)rr"rZextended_errorr r r!r@s    ÿzAnsibleError.messagecCs ||_dSr)r)rÚvalr r r!rRscCs|jSr©r©rr r r!Ú__str__VszAnsibleError.__str__cCs|jSrr(r)r r r!Ú__repr__YszAnsibleError.__repr__cCs�d}d}t|dƒ�f}| ¡}t|ƒ}||kr4|d}||}| ¡sV|d8}||}q<|dkrj||d}Wdƒn1s~0Y||fS)zâ Returns the line in the file which corresponds to the reported error location, as well as the line preceding it (if the error did not occur on the first line), to provide context to the error. rÚrérN)ÚopenÚ readlinesÚlenÚstrip)rÚ file_nameÚ line_numberÚ target_lineÚ prev_lineÚfÚlinesZ file_lengthr r r!Ú_get_error_lines_from_file\s  *z'AnsibleError._get_error_lines_from_filec Csºd}�zt|jj\}}}|t|||f7}|dv�rx|j�rx| ||d¡\}}t|ƒ}t|ƒ}|�rx| dd¡}t d|¡rÊ|  ¡  d¡}d|d} t||d|df}|d|  ¡| f7}|t 7}n*d|dd} |d |  ¡|  ¡| f7}d |v�r|t 7}d |v�r:d |v�r:d |v�s.d|v�r:|t 7}�n>d|v�rZd |v�rZ|t7}�nt|ƒ�r¨t|ƒdk�r¨t|ƒ|k�r¨||dk�r¨| d¡dk�r¨|t7}nÐ| d¡} t| ƒdk�rx| d ¡} d} d} |  d¡�rò|  d¡�sòd} n|  d¡�r|  d¡�sd} t| ƒdk�rH| ddv�rH| ddv�rH| d¡dk�sX| d¡dk�r\d} | �rj|t7}| �rx|t7}Wn:ttf�yš|d7}Ynt�y´|d7}Yn0|S