Ë
    *Càe›  ã                   óè  — d dl mZ d dlmZ d dlZddlmZmZ  G d„ de«      Z G d„ d	e«      Z	 G d
„ de«      Z
 G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z ed „ «      Z ed!„ ej.                  e	j0                  ee	j2                  eiej4                  e
j6                  ee
j8                  eiej:                   ed"„ «      ej<                  ej>                  eej@                  eiejB                  ejD                  eiejF                  ejH                  eii«      Z%d#„ Z&d$e'fd%„Z(y)&é    )Údefaultdict)ÚIntEnumNé   )ÚffiÚlibc                   ó$   — e Zd ZdZdZdZdZdZdZy)ÚNETPLAN_ERROR_DOMAINSr   é   é   é   é   é   N)	Ú__name__Ú
__module__Ú__qualname__ÚNETPLAN_PARSER_ERRORÚNETPLAN_VALIDATION_ERRORÚNETPLAN_FILE_ERRORÚNETPLAN_BACKEND_ERRORÚNETPLAN_EMITTER_ERRORÚNETPLAN_FORMAT_ERROR© ó    ú0/usr/lib/python3/dist-packages/netplan/_utils.pyr	   r	      s&   „ ØÐØ ÐØÐØÐØÐØÑr   r	   c                   ó   — e Zd ZdZdZy)ÚNETPLAN_PARSER_ERRORSr   r   N)r   r   r   ÚNETPLAN_ERROR_INVALID_YAMLÚNETPLAN_ERROR_INVALID_CONFIGr   r   r   r   r   $   s   „ Ø!"ÐØ#$Ñ r   r   c                   ó   — e Zd ZdZdZy)ÚNETPLAN_VALIDATION_ERRORSr   r   N)r   r   r   ÚNETPLAN_ERROR_CONFIG_GENERICÚNETPLAN_ERROR_CONFIG_VALIDATIONr   r   r   r    r    )   s   „ Ø#$Ð Ø&'Ñ#r   r    c                   ó   — e Zd ZdZdZy)ÚNETPLAN_BACKEND_ERRORSr   r   N)r   r   r   ÚNETPLAN_ERROR_UNSUPPORTEDÚNETPLAN_ERROR_VALIDATIONr   r   r   r$   r$   .   s   „ Ø !ÐØ Ñr   r$   c                   ó   — e Zd ZdZy)ÚNETPLAN_EMITTER_ERRORSr   N)r   r   r   ÚNETPLAN_ERROR_YAML_EMITTERr   r   r   r(   r(   3   s   „ Ø!"Ñr   r(   c                   ó   — e Zd ZdZy)ÚNETPLAN_FORMAT_ERRORSr   N)r   r   r   Ú!NETPLAN_ERROR_FORMAT_INVALID_YAMLr   r   r   r+   r+   7   s   „ Ø()Ñ%r   r+   c                   ó   — e Zd Zdd„Zd„ Zy)ÚNetplanExceptionNc                 ó.   — || _         || _        || _        y ©N)ÚdomainÚerrorÚmessage)Úselfr3   r1   r2   s       r   Ú__init__zNetplanException.__init__<   s   € ØˆŒØˆŒ
Øˆ�r   c                 ó   — | j                   S r0   )r3   ©r4   s    r   Ú__str__zNetplanException.__str__A   s   € Ø�|‰|Ðr   ©NNN)r   r   r   r5   r8   r   r   r   r.   r.   ;   s   „ óó
r   r.   c                   ó   — e Zd Zed„ «       Zy)ÚNetplanFileExceptionc                 ó   — | j                   S r0   )r2   r7   s    r   ÚerrnozNetplanFileException.errnoF   s   € à�z‰zÐr   N)r   r   r   Úpropertyr=   r   r   r   r;   r;   E   s   „ Øñó ñr   r;   c                   ó(   ‡ — e Zd ZdZdZdˆ fd„	Zˆ xZS )ÚNetplanValidationExceptiona  
    Netplan Validation errors are expected to contain the YAML file name
    from where the error was found.

    A validation error might happen after the parsing stage. libnetplan walks
    through its internal representation of the network configuration and checks
    if all the requirements are met. For example, if it finds that the key
    "set-name" is used by an interface, it will check if "match" is present.
    As "set-name" requires "match" to work, it will emit a validation error
    if it's not found.
    z((?P<file_path>.*\.yaml): (?P<message>.*)c                 ó°   •— t         ‰| �  |||«       t        j                  | j                  |«      }|st        d|› �«      ‚|d   | _        |d   | _        y )Nz@The validation error message does not have the expected format: Ú	file_pathr3   )Úsuperr5   ÚreÚmatchÚ!SCHEMA_VALIDATION_ERROR_MSG_REGEXÚ
ValueErrorÚfilenamer3   ©r4   r3   r1   r2   Úschema_errorÚ	__class__s        €r   r5   z#NetplanValidationException.__init__\   sZ   ø€ Ü‰Ñ˜ &¨%Ô0ä—x‘x × FÑ FÈÓPˆÙäÐ_Ð`gÐ_hÐiÓjÐjà$ [Ñ1ˆŒØ# IÑ.ˆ�r   r9   )r   r   r   Ú__doc__rF   r5   Ú__classcell__©rK   s   @r   r@   r@   K   s   ø„ ñ
ð 8ð &÷	/ñ 	/r   r@   c                   ó(   ‡ — e Zd ZdZdZdˆ fd„	Zˆ xZS )ÚNetplanParserExceptiona´  
    Netplan Parser errors are expected to contain the YAML file name
    and line and column numbers from where the error was found.

    A parser error might happen during the parsing stage. Parsing errors
    might be due to invalid YAML files or invalid Netplan grammar. libnetplan
    will check for this kind of issues while it's walking through the YAML
    files, so it has access to the location where the error was found.
    zN(?P<file_path>.*):(?P<error_line>\d+):(?P<error_col>\d+): (?P<message>(\s|.)*)c                 óØ   •— t         ‰| �  |||«       t        j                  | j                  |«      }|st        d|› �«      ‚|d   | _        |d   | _        |d   | _        |d   | _	        y )Nz<The parser error message does not have the expected format: rB   Ú
error_lineÚ	error_colr3   )
rC   r5   rD   rE   ÚSCHEMA_PARSER_ERROR_MSG_REGEXrG   rH   ÚlineÚcolumnr3   rI   s        €r   r5   zNetplanParserException.__init__w   st   ø€ Ü‰Ñ˜ &¨%Ô0ô —x‘x × BÑ BÀGÓLˆÙäÐ[Ð\cÐ[dÐeÓfÐfà$ [Ñ1ˆŒØ  Ñ.ˆŒ	Ø" ;Ñ/ˆŒØ# IÑ.ˆ�r   r9   )r   r   r   rL   rT   r5   rM   rN   s   @r   rP   rP   h   s   ø„ ñð ^ð "÷/ñ /r   rP   c                   ó   — e Zd Zy)ÚNetplanBackendExceptionN©r   r   r   r   r   r   rX   rX   ‰   ó   „ Ør   rX   c                   ó   — e Zd Zy)ÚNetplanEmitterExceptionNrY   r   r   r   r\   r\   �   rZ   r   r\   c                   ó   — e Zd Zy)ÚNetplanFormatExceptionNrY   r   r   r   r^   r^   ‘   rZ   r   r^   c                  ó   — t         S r0   )r.   r   r   r   ú<lambda>r`   –   s   € Ô2B€ r   c                  ó   — t         S r0   )ÚNETPLAN_EXCEPTIONS_FALLBACKr   r   r   r`   r`   š   s   € Ô)D€ r   c                  ó   — t         S r0   )r;   r   r   r   r`   r`   ¦   s   € ÔFZ€ r   c                 ó`  ‡	— t        j                  d«      }t         | g |¢|‘­Ž «      }|s‚|d   Š	‰	t         j                  k(  rt	        ddd«      ‚t        j                  ‰	«      }|dz	  }t        t        j                  d|«      «      }t        ˆ	fd„«      }t        |   |   } ||||«      ‚|S )NzNetplanError **r   zUnknown erroré    Úuint32_tc                 óD   •— t        j                  ‰| t        | «      «      S r0   )r   Únetplan_error_messageÚlen)ÚbÚerrs    €r   r`   z#_checked_lib_call.<locals>.<lambda>Á   s   ø€ Ä×@YÑ@YÐZ]Ð_`ÔbeÐfgÓbhÓ@i€ r   )r   ÚnewÚboolÚNULLr.   r   Únetplan_error_codeÚintÚcastÚ_string_realloc_call_no_errorÚNETPLAN_EXCEPTIONS)
ÚfnÚargsÚrefÚretÚdomain_codeÚerror_domainÚ
error_codeÚerror_messageÚ	exceptionrk   s
            @r   Ú_checked_lib_callr}   ·   s©   ø€ Ü
�'‰'Ð#Ó
$€CÜ
‰rˆ~�4ˆ~˜Š~Ó
€CÙØ�!‰fˆØ”#—(‘(Š?Ü" ?°A°qÓ9Ð9Ü×,Ñ,¨SÓ1ˆØ" bÑ(ˆÜœŸ™ *¨kÓ:Ó;ˆ
Ü5Ó6iÓjˆÜ& |Ñ4°ZÑ@ˆ	Ù˜ |°ZÓ@Ð@Ø€Jr   Úfunctionc                 óò   — d}|dk  rft        j                  d|«      } | |«      }|dk(  r|dz  }Œ.|dk  rt        d|z  «      ‚|dk(  ry t        j                  |«      j	                  d«      S t        d	«      ‚)
Né   i   zchar[]éþÿÿÿr
   r   zUnknown error: %dzutf-8z&Halting due to string buffer size > 1M)r   rl   r.   ÚstringÚdecode)r~   ÚsizeÚbufÚcodes       r   rr   rr   Ç   s�   € Ø€DØ
�Š.Ü�g‰g�h Ó%ˆÙ˜‹}ˆØ�2Š:Ø˜!‘8ˆDØà�!Š8Ü"Ð#6¸Ñ#=Ó>Ð>Ø�QŠYØä—:‘:˜c“?×)Ñ)¨'Ó2Ð2Ü
ÐCÓ
DÐDr   ))Úcollectionsr   Úenumr   rD   Ú_netplan_cffir   r   r	   r   r    r$   r(   r+   Ú	Exceptionr.   r;   r@   rP   rX   r\   r^   rb   r   r   r   r   r!   r"   r   r   r%   r&   r   r)   r   r,   rs   r}   Úcallablerr   r   r   r   ú<module>rŒ      s¬  ðõ  $Ý Û 	ç #ô˜Gô ô%˜Gô %ô
( ô (ô
!˜Wô !ô
#˜Wô #ô*˜Gô *ô�yô ôÐ+ô ô/Ð!1ô /ô:/Ð-ô /ôB	Ð.ô 	ô	Ð.ô 	ô	Ð-ô 	ñ
 *Ñ*BÓCÐ ñ !Ñ!DØ×2Ñ2Ø!×<Ñ<Ð>TØ!×>Ñ>Ð@Vð5ð
 	×6Ñ6Ø%×BÑBÐDTØ%×EÑEÐGað9ð 	×0Ñ0±+Ñ>ZÓ2[à×3Ñ3Ø"×<Ñ<Ð>UØ"×;Ñ;Ð=Tð6ð
 	×3Ñ3Ø"×=Ñ=Ð?Vð6ð 	×2Ñ2Ø!×CÑCÐE[ð5ð/G
ó Ð ò:ð E¨Hô Er   