%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/errors/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/errors/__pycache__/__init__.cpython-39.pyc

a

�)g99�@sddlmZmZmZeZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZmZmZmZddlmZmZGdd�de�ZGdd	�d	ee�ZGd
d�de�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	��Zdd�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�linesZfile_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}|t7}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)a�
        Given an object reporting the location of the exception in a file, return
        detailed information regarding it including:

          * the line which caused the error as well as the one preceding it
          * causes and suggested remedies for common syntax errors

        If this error was created with show_content=False, the reporting of content
        is suppressed, as the file contents may be sensitive (ie. vault data).
        r)z<string>z	<unicode>r-� z\w+(\s+)?=(\s+)?[\w/-]+�=z^ herez+
The offending line appears to be:

%s
%s

z-
The offending line appears to be:

%s
%s
%s
�	z{{z}}z"{{z'{{z:{{�:F�'T�"r)r>r=����z&
(could not open file to display line)z6
(specified line no longer in file, maybe it changed?))rZansible_posrrr8r�replace�re�search�rstrip�findr
rrrr0�countr
�splitr1�
startswith�endswithrr	�IOError�	TypeError�
IndexError)rZ
error_messageZsrc_filer3Z
col_numberr4r5Z
stripped_lineZerror_positionZ
arrow_line�partsZmiddle�matchZ
unbalancedr r r!r$}s|

(

�
�
��


�
���z AnsibleError._get_extended_error)rNTFN)
�__name__�
__module__�__qualname__�__doc__r�propertyr�setterr*r+r8r$�
__classcell__r r rr!r(s	

!rc@seZdZdZdS)�AnsibleAssertionErrorzInvalid assertionN�rOrPrQrRr r r r!rV�srVc@seZdZdZdS)�AnsibleOptionsErrorz" bad or incomplete options passed NrWr r r r!rX�srXc@seZdZdZdS)�AnsibleParserErrorzJ something was detected early that is wrong about a playbook or data file NrWr r r r!rY�srYc@seZdZdZdS)�AnsibleInternalErrorzV internal safeguards tripped, something happened in the code that should never happen NrWr r r r!rZ�srZc@seZdZdZdS)�AnsibleRuntimeErrorz0 ansible had a problem while running a playbook NrWr r r r!r[�sr[c@seZdZdZdS)�AnsibleModuleErrorz a module failed somehow NrWr r r r!r\�sr\c@seZdZdZdS)�AnsibleConnectionFailurez5 the transport / connection_plugin had a fatal error NrWr r r r!r]�sr]c@seZdZdZdS)�AnsibleAuthenticationFailurezinvalid username/password/keyNrWr r r r!r^�sr^c@seZdZdZdS)�AnsibleCallbackErrorz a callback failure NrWr r r r!r_�sr_c@seZdZdZdS)�AnsibleTemplateErrorzA template related errorNrWr r r r!r`sr`c@seZdZdZdS)�AnsibleFilterError� a templating failure NrWr r r r!rasrac@seZdZdZdS)�AnsibleLookupErrorz a lookup failure NrWr r r r!rc
srcc@seZdZdZdS)�AnsibleUndefinedVariablerbNrWr r r r!rdsrdcs"eZdZdZd�fdd�	Z�ZS)	�AnsibleFileNotFoundz a file missing failure rNTFc	s�||_||_|r|d7}|jr2|dt|j�7}n|d7}|jrtt|jt�rttd�|j��}|rh|d7}|d|7}|d7}tt|�j|||||d�dS)N�
zCould not find or access '%s'zCould not find filez
	zSearched in:
	%sz{ on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option�rrrrr)	r2�pathsrr#rr&rrer)	rrrrrrrhr2Zsearchedrr r!rs �zAnsibleFileNotFound.__init__)rNTFNNN�rOrPrQrRrrUr r rr!resrecs"eZdZdZd�fdd�	Z�ZS)	�
AnsibleActionz/ Base Exception for Action plugin flow control rNTFcs4tt|�j|||||d�|dur*i|_n||_dS)Nrg)rrjr�result�rrrrrrrkrr r!r8s�zAnsibleAction.__init__)rNTFNNrir r rr!rj5srjcs"eZdZdZd�fdd�	Z�ZS)	�AnsibleActionSkipz an action runtime skiprNTFcs2tt|�j||||||d�|j�d|d��dS)N�rrrrrrkT)Zskipped�msg)rrmrrk�updaterlrr r!rEs�zAnsibleActionSkip.__init__)rNTFNNrir r rr!rmBsrmcs"eZdZdZd�fdd�	Z�ZS)	�AnsibleActionFailz an action runtime failurerNTFcs8tt|�j||||||d�|j�d|t��d��dS)NrnT)Zfailedro�	exception)rrqrrkrp�	traceback�
format_excrlrr r!rMs�zAnsibleActionFail.__init__)rNTFNNrir r rr!rqKsrqc@seZdZdZdS)�_AnsibleActionDonez an action runtime early exitNrWr r r r!ruSsrucs"eZdZdZd�fdd�	Z�ZS)�AnsiblePluginErrorz\ base class for Ansible plugin-related errors that do not need AnsibleError contextual data Ncstt|��|�||_dSr)rrvr�plugin_load_context)rrrwrr r!rZszAnsiblePluginError.__init__)NNrir r rr!rvXsrvc@seZdZdZdS)�AnsiblePluginRemovedErrorz% a requested plugin has been removed NrWr r r r!rx_srxc@seZdZdZdS)�AnsiblePluginCircularRedirectz*a cycle was detected in plugin redirectionNrWr r r r!rydsryc@seZdZdZdS)�(AnsibleCollectionUnsupportedVersionErrorz8a collection is not supported by this version of AnsibleNrWr r r r!rzisrzc@seZdZdZdS)�AnsibleFilterTypeErrorz2 a Jinja filter templating failure due to bad typeNrWr r r r!r{nsr{c@seZdZdZdS)�AnsiblePluginNotFoundz- Indicates we did not find an Ansible plugin NrWr r r r!r|ssr|)2Z
__future__rrr�typeZ
__metaclass__rBrs�collections.abcrZansible.errors.yaml_stringsrrrr	r
rrr
Zansible.module_utils._textrr�	Exceptionr�AssertionErrorrVrXrYrZr[r\r]r^r_r`rarcrdrerjrmrqrurvrxryrzrKr{r|r r r r!�<module>s@(
/
	

Zerion Mini Shell 1.0