Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/boto/pyami/__pycache__/ |
Upload File : |
o ckF[� � @ s8 d dl Z d dlmZ d dlZd dlZG dd� de�ZdS )� N)� ScriptBasec sD e Zd Z� fdd�Zdd� Zdd� Zdd� Zd d � Zdd� Z� Z S ) �CopyBotc s t t| ��� tj�dd�| _d| j | _t j �| j| j�| _t� | j| j� tj�| jd�| _tj�| jd�| _tj�| jdd�| _t�� }|�| j�| _| jsZtj�d| j � tj�| jd d �}|rttj�| jd d �}t�||�}|�| j�| _| js�|�| j�| _d S d S )N�Pyami�working_dirz%s.log� src_bucket� dst_bucket�replace_dstTz Source bucket does not exist: %s�dest_aws_access_key_id�dest_aws_secret_access_key)�superr �__init__�boto�config�get�wdir�instance_id�log_file�os�path�join�log_path�set_file_logger�name�src_name�dst_name�getbool�replace� connect_s3�lookup�src�log�error�connect�dst� create_bucket)�self�s3�dest_access_key�dest_secret_key�� __class__� �4/usr/lib/python3/dist-packages/boto/pyami/copybot.pyr s( �zCopyBot.__init__c C s0 t j�| jdd�r| j�� }| j�|� d S d S �N� copy_aclsT)r r r r r �get_xml_aclr# �set_xml_acl)r% �aclr+ r+ r, �copy_bucket_acl1 s �zCopyBot.copy_bucket_aclc C s, t j�| jdd�r|�� }|�|� d S d S r- )r r r r r/ r0 )r% r r# r1 r+ r+ r, �copy_key_acl6 s �zCopyBot.copy_key_aclc C s t j�d| jj � t j�d| jj � z\| jD ]U}| js4| j�|j�}|r4t j�d|j| jjf � qt j�d|j|jf � t j �|j�\}}t j �| j |�}|�|� | j�|j�}|�|� | �||� t �|� qW d S t j�d|j � Y d S )Nzsrc=%szdst=%sz%key=%s already exists in %s, skippingzcopying %d bytes from key=%szError copying key: %s)r r �infor r r# r r �sizer r �splitr r �get_contents_to_filename�new_key�set_contents_from_filenamer3 �unlink� exception)r% �key�exists�prefix�baser r8 r+ r+ r, � copy_keys; s( �zCopyBot.copy_keysc C s | j �| j�}|�| j� d S )N)r# r8 r r9 r )r% r<