HEX
Server: Apache
System: Linux pdx1-shared-a1-29 6.18.39-grsec-noble+ #4 SMP Thu Jul 23 07:53:29 UTC 2026 x86_64
User: dh_bj99yp (22285841)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/boto/pyami/__pycache__/bootstrap.cpython-312.pyc
�

ckF[t���ddlZddlZddlmZmZddlmZmZddlm	Z	ddl
Z
Gd�de	�Zedk(r+ejdd	�e�Zej�yy)
�N)�get_instance_metadata�get_instance_userdata)�Config�BotoConfigPath)�
ScriptBasec�F��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
�xZS)	�	Bootstrapa\
    The Bootstrap class is instantiated and run as part of the PyAMI
    instance initialization process.  The methods in this class will
    be run from the rc.local script of the instance and will be run
    as the root user.

    The main purpose of this class is to make sure the boto distribution
    on the instance is the one required.
    c�X��d|_|j�tt|��y)Nz
/mnt/pyami)�working_dir�write_metadata�superr	�__init__)�self�	__class__s ��6/usr/lib/python3/dist-packages/boto/pyami/bootstrap.pyrzBootstrap.__init__(s$���'�������
�i��'�)�c���ttjjt�d�}|jd�t
�}|D]}|j|�d||�d���t�}|jd|z�|jd�|jd|jz�|j�t�t_tj�y)N�wz[Instance]
z = �
z
%s
z[Pyami]
zworking_dir = %s
)�open�os�path�
expanduserr�writerrr�closer�boto�config�init_logging)r�fp�	inst_data�key�	user_datas     rrzBootstrap.write_metadata-s���
�"�'�'�$�$�^�4�c�
:��
���� �)�+�	��	:�C��H�H�C��3��8�9�	:�)�+�	�
����I�%�&�
�����
���%��(8�(8�8�9�
���
��h������rc���tjjd|jz�tj
j
|j�s t	j|j�yy)NzWorking directory: %s)r�log�inforrr�exists�mkdir�rs r�create_working_dirzBootstrap.create_working_dir>sK�����
�
�-��0@�0@�@�A��w�w�~�~�d�.�.�/��H�H�T�%�%�&�0rc�R�tjjddd�}|jd�ri|j	d�dk\r|jd�\}}d|z}nd}tjjdd	d
�}|j
d|�d|���y|jd
�r�tjjdd	d�}d}|dkDr!|dz}	|j
d|��d}|dkDr�!|j	d�dk\r|jd�\}}nd}|j
d|z|��y|j
d�|j
d|z�y#t$r?}tjjd|�tjd�Yd}~��d}~wwxYw)N�Boto�boto_updatezsvn:HEAD�svn�:rz-r%sz-rHEAD�
boto_locationz/usr/local/botozsvn update � �gitz*/usr/share/python-support/python-boto/boto�
�zgit pull)�cwdzOgit pull attempt failed with the following exception. Trying again in a bit. %s��masterzgit checkout %sz.rm /usr/local/lib/python2.5/site-packages/botozeasy_install %s)rr�get�
startswith�find�split�run�	Exceptionr$r%�time�sleep)r�update�method�version�location�num_remaining_attempts�es       r�	load_botozBootstrap.load_botoCsw���������
�C�����U�#��{�{�3��1�$�"(�,�,�s�"3���� �7�*��"���{�{���v��@Q�R�H��H�H�7�H�=�>�
�
�
�u�
%��{�{���v��@l�m�H�%'�"�(�1�,�&�!�+�&�"��H�H�Z�X�H�6�-.�*�	)�1�,��{�{�3��1�$�"(�,�,�s�"3����"���H�H�&��0�h�H�?�
�H�H�E�F��H�H�&��/�0��!�"��H�H�M�M�"s�uv�w��J�J�q�M�M��"�s�E�	F&�'5F!�!F&c�F�	ddlm}||�}tjj	|j
|j
d�d�}t|d�j|j��|S#tjjd|z�d}Y|SxYw)Nr)�
fetch_file�/���rzProblem Retrieving file: %s)
�
boto.utilsrGrr�joinrr:rr�readrr$�	exception)r�s3_filerG�frs     r�
fetch_s3_filezBootstrap.fetch_s3_filebs���	�-��7�#�A��7�7�<�<�� 0� 0�'�-�-��2D�R�2H�I�D���s�O�!�!�!�&�&�(�+����	��H�H���<�w�F�G��D���s�A3A7�7&B c�4�tjjdd�}|rv|jd�}|D]_}|j	�}|jd�r|j
|�}|s�8|jd�r�J|jd|zd���ayy)	N�Pyami�packages�,zs3:z.pyzeasy_install -Z %sF)�
exit_on_error)	rrr7r:�stripr8rP�endswithr;)r�package_strrS�packages    r�
load_packageszBootstrap.load_packagesms����k�k�o�o�g�z�:���"�(�(��-�H�#�
V��!�-�-�/���%�%�e�,�"�0�0��9�G��#�+�+�E�2����!5��!?�u��U�
V�rc���|j�|j�|j�|jdtj
j
d�z�y)NzBootstrap Completed for %szinstance-id)r)rErZ�notifyrr�get_instancer(s r�mainzBootstrap.main{sE�����!������������0�4�;�;�3K�3K�M�3Z�Z�[r)�__name__�
__module__�__qualname__�__doc__rrr)rErPrZr^�
__classcell__)rs@rr	r	s-����*�
�"'�
1�>	�V�\rr	�__main__�	bootstrapz/var/log/boto.log)rrrJrr�boto.pyami.configrr�boto.pyami.scriptbaserr=r	r_�set_file_logger�bsr^�rr�<module>rks^��,
��C�4�,��b\�
�b\�H�z���D����&9�:�	��B��G�G�I�r