/usr/lib/python3/dist-packages/cloudinit/sources/azure/__pycache__
Edit: /usr/lib/python3/dist-packages/cloudinit/sources/azure/__pycache__/imds.cpython-310.pyc (5365B)
o
th$ @ s d dl Z d dlZd dlmZ d dlmZmZmZmZ d dl Z d dl
mZ d dlm
Z
d dlmZmZ e eZdZdd ZG d
d dZdd
ddededededef
ddZdededefddZ ddedee defddZdefddZdS ) N) monotonic)DictOptionalTypeUnion)util)report_diagnostic_event)UrlErrorreadurlzhttp://169.254.169.254/metadatac C s dt t dS )Ntrue)Metadatazx-ms-client-request-id)struuiduuid4)_url r >/usr/lib/python3/dist-packages/cloudinit/sources/azure/imds.py
headers_cb s
r c @ sL e Zd ZdZddddddedee dee d dfd
dZd efdd
Z dS )ReadUrlRetryHandleraK Manager for readurl retry behavior using exception_callback().
:param logging_backoff: Backoff to limit logging.
:param max_connection_errors: Number of connection errors to retry on.
:param retry_codes: Set of http codes to retry on.
:param retry_deadline: Optional monotonic()-based deadline to retry until.
?N) i logging_backoffmax_connection_errorsretry_codesretry_deadliner r r returnc C s. || _ || _|| _|| _d| _d| _d | _d S )Nr r )r r r r _logging_threshold_request_count_last_error)selfr r r r r r r __init__% s
zReadUrlRetryHandler.__init__c C s@ | j d7 _ t|tstd| tjd dS d}| jd ur't | jkr'd}nd}| jd urDt|j t
jrD| jd8 _| jdkrCd}n
|jd urQ|j| j
vrQd}| j | jkr`| j| j9 _nd}|jd urt| j|jkrsd}|j| _n| jd u st| jtrt|j | jsd}t|j | _|s|std| j |f tjd |S )N z1Polling IMDS failed with unexpected exception: %rlogger_funcFTr z1Polling IMDS failed attempt %d with exception: %r)r
isinstancer r LOGwarningr r r causerequestsConnectionErrorcoder r r r! type)r" exceptionlogretryr r r exception_callback: s^
z&ReadUrlRetryHandler.exception_callback)
__name__
__module____qualname____doc__floatr intr# boolr2 r r r r r s
r T )log_responsetimeouturl
retry_handlerr; r<