File: //lib/python3/dist-packages/boto/pyami/__pycache__/bootstrap.cpython-310.pyc
o
ckF[t � @ s~ d dl Z d dlZd dlmZmZ d dlmZmZ d dlm Z d dl
Z
G dd� de �Zedkr=e�
dd � e� Ze�� dS dS )
� N)�get_instance_metadata�get_instance_userdata)�Config�BotoConfigPath)�
ScriptBasec sP e Zd ZdZ� fdd�Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
� ZS )� 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 s d| _ | �� tt| ��� d S )Nz
/mnt/pyami)�working_dir�write_metadata�superr �__init__��self�� __class__� �6/usr/lib/python3/dist-packages/boto/pyami/bootstrap.pyr ( s zBootstrap.__init__c C s� t tj�t�d�}|�d� t� }|D ]
}|�d||| f � qt� }|�d| � |�d� |�d| j � |� � t
� t_t�
� d S )N�wz[Instance]
z%s = %s
z
%s
z[Pyami]
zworking_dir = %s
)�open�os�path�
expanduserr �writer r r �closer �boto�config�init_logging)r
�fp� inst_data�key� user_datar r r r - s
zBootstrap.write_metadatac C s4 t j�d| j � tj�| j�st�| j� d S d S )NzWorking directory: %s)r �log�infor r r �exists�mkdirr r r r �create_working_dir>