ruạṛ
a ���fK � @ s~ d Z ddlmZ ddlZddlZddlmZ ddlm Z m Z ddlmZ dae� � add � Zd d� Zedd dd�dd� �ZdS )z7 Use this package to get the instance principal signer � )�absolute_importN)�%InstancePrincipalsSecurityTokenSigner)� get_domain�get_region_info� )�retryc C sT t �< td u r2| �d� t| ||||�a| �d� W d � n1 sF0 Y tS )Nz"Creating instance principal signerz+Instance principal signer creation complete)�_instance_principal_signer_lock�_instance_principal_signer�debug� create_instance_principal_signer)�logger�instance_metadata�cert�region�config� r �R/sparta/input/python_modules/oci_agent_utils/oci_agent_utils/instance_principal.py�get_instance_principal_signer s (r c C s` |dkr| � d� dS |�d�}|d urH||v rH| � d�|�� || S t|�}djf i |��S )Nzus-seattle-1z2Region is us-seattle-1, returning r1 auth endpointz&https://auth.r1.oracleiaas.com/v1/x509�authz{} found in auth configz&https://auth.{region}.{domain}/v1/x509)r �get�formatr )r r r r r �auth_config_list�region_infor r r �get_auth_endpoint s r � � i, )�tries�base�capc C s� t jjddt jjd��d��d��� �� }z&| �d� t |t | ||||�|d�W S ty� } z| �d� |�� W Y d }~n d }~0 0 d S ) NiX �<