+
    i                         ^ RI t ^ RIt^ RIHt ^ RIHtHtHtHt ]P                  ! ]
4      tR.t^tRt ! R R]P                  4      tR R	 ltR
 R lt]]P&                  ]P(                  33.tR tR# )    N)Optional)dmisources
url_helperutilzhttp://169.254.169.254CloudCIXc                      a a ] tR t^t oRt^t^t^tV 3R ltR t	V3R lR lt
V3R lR lt]R 4       t]R	 4       tR
tVtV ;t# )DataSourceCloudCIXr   c                L   < \         \        V `  WV4       R V n        R V n        R # N)superr
   __init___metadata_url_net_cfg)selfsys_cfgdistropaths	__class__s   &&&&F/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudCIX.pyr   DataSourceCloudCIX.__init__   s$     $0%H!    c                     V P                  4       pTR,          T n        \        P                  ! TR,          4      T n        R#   \        P                   d"   p\        P	                  RT4        Rp?R# Rp?ii ; i)z&
Fetch the user data and the metadata
z0Failed to read data from CloudCIX datasource: %sNF	meta-data	user-dataT)	crawl_metadata_servicer   InvalidMetaDataExceptionLOGerrormetadatar   decode_binaryuserdata_raw)r   crawled_datar   s   &  r   	_get_dataDataSourceCloudCIX._get_data   sl    	668L %[1 ..|K/HI // 	IIBE 		s   A A:A55A:c                    < V ^8  d   QhRS[ /#    return)dict)format__classdict__s   "r   __annotate__DataSourceCloudCIX.__annotate__/   s       r   c                    V P                  4       pVf   \        P                  ! R4      h\        WP	                  4       4      pV# )Nz Could not determine metadata URL)determine_md_urlr   r   read_metadataget_url_params)r   md_urldatas   &  r   r   )DataSourceCloudCIX.crawl_metadata_service/   sE    &&(>222  V%8%8%:;r   c                0   < V ^8  d   QhRS[ S[,          /# r'   )r   str)r+   r,   s   "r   r-   r.   9   s     !" !"(3- !"r   c                   V P                   '       d   V P                   # V P                  4       p\        P                  ! \        VP
                  VP                  R 7      w  r#V'       g   R# \        \        ^ R4       F  p\        P                  ! VRP                  V4      R4      p \        P                  ! WPP                  R7      pTP!                  4       '       d9   \        P                  ! TRP                  T4      4      T n          T P                   # \        P                  RT4       K  	  V P                   #   \        P                   d"   p\        P                  RYW4        Rp?K  Rp?ii ; i))max_waittimeoutNzv{0}r    )r:   zURL %s raised exception %szNo metadata found at URL %s)r   r2   r   wait_for_urlMETADATA_URLSmax_wait_secondstimeout_secondsrangeMETADATA_VERSIONcombine_urlr+   readurlurl_timeoutUrlErrorr   debugok)r   
url_paramsbase_url_versionurlresponsees   &       r   r0   #DataSourceCloudCIX.determine_md_url9   s4   %%% ((*
 --00..

  -q"5G((&--0*C%--c;K;KL
 {{}}%/%;%;fmmG4&"  !!! 		7=! 6$ !!! && 		6?s   (!D==E3E..E3c                     \        4       # r   )is_platform_viable r   r   	ds_detectDataSourceCloudCIX.ds_detect\   s    !##r   c                    V P                   '       d   V P                   # V P                  '       g   R # V P                  R,          V n         V P                   # )Nnetwork)r   r    )r   s   &r   network_config!DataSourceCloudCIX.network_config`   s;    ===== }}}i0}}r   )r   r   r    r"   )__name__
__module____qualname____firstlineno__dsnameurl_retriesurl_timeout_secondsurl_sec_between_retriesr   r$   r   r0   staticmethodrS   propertyrW   __static_attributes____classdictcell____classcell__)r   r,   s   @@r   r
   r
      sg     FK
" !" !"F $ $   r   r
   c                $    V ^8  d   QhR\         /# r'   )bool)r+   s   "r   r-   r-   k   s     I ID Ir   c                  <    \         P                  ! R 4      \        8H  # )zsystem-product-name)r   read_dmi_dataCLOUDCIX_DMI_NAMErR   r   r   rQ   rQ   k   s    237HHHr   c                $    V ^8  d   QhR\         /# )r(   rI   )r7   )r+   s   "r   r-   r-   o   s     - -C -r   c                   / pRR\         P                  3RR\         P                  33pV F  w  rEp \        P                  ! \        P
                  ! W4      VP                  VP                  VP                  R7      pTP                  4       '       g-   \        P                  ! R
T RT  RT RTP                   24      h T! TP                  4      Y%&   K  	  V#   \        P                   d(   p\        P                  ! RT RT  RT RT 24      hR	p?ii ; i  \        P                   P"                   d&   p	\        P                  ! RT  RT RT	 24      T	hR	p	?	ii ; i)a  
Read metadata from metadata server at base_url

:returns: dictionary of retrieved metadata and user data containing the
          following keys: meta-data, user-data
:param: base_url: meta data server's base URL
:param: url_params: dictionary of URL retrieval parameters. Valid keys are
        `retries`, `sec_between` and `timeout`.
:raises: InvalidMetadataException upon network error connecting to metadata
         URL, error response from meta data server or failure to
         decode/parse metadata and userdata payload.
r    r   userdatar   )rL   retriessec_betweenr:   zFailed to fetch IMDS z: /Nz	No valid z found. URL z returned code zInvalid JSON at )r   	load_jsonmaybe_b64decoder   rC   rB   num_retriessec_between_retriesr?   rE   r   r   rG   codecontentsjsondecoderJSONDecodeError)
rI   rH   mdleaf_key_format_callbackurl_leafnew_keyformat_callbackrM   r   excs
   &&        r   r1   r1   o   sv    
B	[$..1	[$"6"67 
 /G*?	!))**8>"..&::"22	H {{}}22H: &j(?8==/K 
	)(*;*;<BK+ /G4 I% "" 	22'z*AhZr%2 	 ||++ 	22"8*AhZr#?	s0   ACDD0"DDE9 EEc                 8    \         P                  ! V \        4      # r   )r   list_from_dependsdatasources)dependss   &r   get_datasource_listr      s    $$Wk::r   )rw   loggingtypingr   	cloudinitr   r   r   r   	getLoggerrY   r   r=   rA   rj   
DataSourcer
   rQ   r1   DEP_FILESYSTEMDEP_NETWORKr   r   rR   r   r   <module>r      s       4 4!)*  W++ WtI-d '00'2E2EFG;r   