+
    i                        ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	H
t
HtHt ^ RIHt ^ RIHt ]P"                  ! ]4      t]! 4       RR l4       tR tR	 tR
 tR tR tR t]! 4       R 4       tR tR tRR ltR tR t R t!R# )    N)	lru_cache)
exceptions)dminetsubp
url_helperutil)NoDHCPLeaseError)EphemeralDHCPv4c           
         \        R 4      p\        4        FX  p \        V VRV/.R7      ;_uu_ 4        \        WW4V4      p	\        P
                  ! V	4      p
\        V
4       V
uuRRR4       u # 	  Vh  + '       g   i     Ko  ; i  \        \        P                  \         \        P                  3 d$   p\        P                  RT4       Tp Rp?K  Rp?ii ; i)zFailed to DHCPurl)ifaceconnectivity_urls_dataNzDHCP Exception: %s)RuntimeErrorget_interface_listr   read_metadatajsonloadsrefactor_metadatar
   r   ProcessExecutionErrorr   RequestExceptionLOGerror)distror   timeoutretriessec_betweenagenttmp_dir	exceptionr   v1metadataexcs   &&&&&&&     A/usr/lib/python3/dist-packages/cloudinit/sources/helpers/vultr.pyget_metadatar%      s    
 -.I $%	 ).~  #3uM::b>!(+  &* O'   &&''	
 	 II*C0I	s4   B0A4#
B4B?BB/C7CCc                     V R ,          V R&   V R,          V R&   V R,          R,          pRV R,          9   d   V R,          R,          pVP                  4       V R&   R# )zinstance-v2-idzinstance-idhostnamezlocal-hostnameregion
regioncodecountrycodeN)lower)r"   r(   s   & r$   r   r   5   s]    &'78H]!)*!5Hh-F**(#M2HX    c                     . p  R p\         P                  P                  V4      '       dn   \        P                  ! VRRR7      pVP                  P                  4        F6  pVP                  4       p\        V4      ^ 8  g   K%  V P                  V4       K8  	  T '       g7   \        P                  ! 4        F  pRT9   d   K  T P                  T4       K  	  T #   \         d!   p\        P                  RT4        Rp?LfRp?ii ; i)z!/opt/vultr/find_candidate_nics.shT)captureshellz(find_candidate_nics script exception: %sNdummy)ospathexistsr   stdout
splitlinesstriplenappend	Exceptionr   r   r   find_candidate_nics)ifaces
nic_scriptoutliner   es         r$   r   r   ?   s     F	A8
77>>*%%))JDAC

--/

u:>MM%( 0 ,,.E%MM% 	 / M  A		<a@@As#   &C AC C D#C>>Dc                  ^    R \         P                  ! R4      R\         P                  ! R4      /# )manufacturerzsystem-manufacturersubidzsystem-serial-number)r   read_dmi_data r,   r$   get_sysinforE   \   s.    ))*?@""#9: r,   c                  6    \        4       R ,          R8w  d   R# R# )rA   VultrTF)rE   rD   r,   r$   is_baremetalrH   d   s    }^$/r,   c                      \        4       p V R ,          R8X  d   R# R\        P                  ! 4       P                  4       9   d   R# R# )rA   rG   TvultrF)rE   r	   get_cmdlinesplit)sysinfos    r$   is_vultrrN   k   s;    mG~') $""$**,,r,   c                     R V ,          p RRRV/p\         P                  ! V VVVVR7      pVP                  4       '       g   \        RV ,          VP                  4      hVP
                  P                  4       # )z
%s/v1.jsonzMetadata-Token	cloudinitz
User-Agent)r   r   headersr   z!Failed to connect to %s: Code: %s)r   readurlokr   codecontentsdecode)r   r   r   r   r   rQ   responses   &&&&&  r$   r   r   z   sz    

C  lEBG!!H ;;==/#5x}}
 	
 ##%%r,   c                  ,    \         P                  ! 4       # N)r   get_interfaces_by_macrD   r,   r$   get_interface_mapr[      s    $$&&r,   c                 H    \        4       pW9  d   R # VP                  V 4      # rY   )r[   get)macmacs_to_nics   & r$   get_interface_namer`      s"    #%K
??3r,   c                 X   R ^RRRRRR././p\        V 4      ^ 8  d-   \        V ^ ,          RR7      pVR,          P                  V4       \        ^\        V 4      4       FG  pW,          pVP	                  R	4      '       d   K$  \        V4      pVR,          P                  V4       KI  	  V# )
versionconfigtype
nameserveraddressz108.61.10.10z2001:19f0:300:1704::6T)primaryunconfigured)r7   generate_interfacer8   ranger]   )
interfacesnetworkpublici	interfaceprivates   &     r$   generate_network_configrq      s    1N,CD
G :#JqM4@  ( 1c*o&M	 ==(($Y/  ) ' Nr,   c           	      R   \        V R ,          4      pV'       g   \        RV R ,          ,          4      hRVRRRV R ,          /pV'       d   ^VR&   RRRR	/RR
RR	/.VR&   V'       g+   RRRR	RV R,          R,          RV R,          R,          /.VR&   \        W4       \        W4       V# )r^   .Interface: %s could not be found on the systemnamerd   physicalmac_address	accept-radhcpcontrolauto
ipv6_slaacsubnetsstaticrf   ipv4netmask)r`   r   generate_interface_routes'generate_interface_additional_addresses)ro   rg   interface_namenetcfgs   &&  r$   ri   ri      s    '	%(89N<y?OO
 	

 	
y'F {VY/\9f5
y
  69V,Y79V,Y7	
y i0+I> Mr,   c                     R V 9   d   V R ,          VR &   RV 9   d   V R,          VR&   RV 9   d   V R,          VR,          ^ ,          R&   R# R# )mturw   routesr|   NrD   )ro   r   s   &&r$   r   r      sU    	!%(ui'4{9)28)<y!X& r,   c           
         \        V R ,          R,          4      pR V 9   db   V^ 8  d[   V R ,          R,           FF  pRRRRRVR,          RVR,          /pRV9   d   VR,          VR&   VR	,          P                  V4       KH  	  \        V R
,          R,          4      pR
V 9   dk   V^ 8  db   V R
,          R,           FK  pRRRRRVR,          : RVR,          : 2/pRV9   d   VR,          VR&   VR	,          P                  V4       KM  	  R# R# R# )r~   
additionalrd   r}   ry   rz   rf   r   r   r|   ipv6static6rl   /prefixN)r7   r8   )ro   r   additional_countr   adds   &&   r$   r   r      s+   9V,\:;/!3#F+L99J6:i0:i0	C :% *8 4H9$$S) : 9V,\:;/!3#F+L99J	6i((*X*>@C :% *8 4H9$$S) :  4r,   c                     V R ,           FJ  pVR,          R8w  d   K  \        VR,          4      pV'       g   \        RVR,          ,          4      hW!R&   KL  	  R# )rc   rd   ru   rv   rs   rt   N)r`   r   )r   ro   r   s   &  r$   add_interface_namesr     s]    H%%	V
*+Im,DE@M*+  +& &r,   rY   )F)"r   loggingr1   	functoolsr   requestsr   rP   r   r   r   r   r	   cloudinit.net.dhcpr
   cloudinit.net.ephemeralr   	getLogger__name__r   r%   r   r   rE   rH   rN   r   r[   r`   rq   ri   r   r   r   rD   r,   r$   <module>r      s   
   	   6 6 / 3 !  @(:&0 ' '
 <"J	=*F
+r,   