Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyo
�
��Xc@s�ddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZde
eefd	��YZd
�ZdS(i����N(tArg(tFileTransferProgressBarMixin(tBundleManifest(tBundleUploadingMixin(t	S3Request(t	PutObjecttUploadBundlecBs�eZdZedddddedd�edd	dd
dd�eddd
dedddej�eddddd�gZd�Z	d�Z
d�ZRS(s:Upload a bundle prepared by euca-bundle-image to the clouds-ms
--manifesttmetavartFILEtrequiredthelps,manifest for the bundle to upload (required)s-ds--directorytDIRshdirectory that contains the bundle parts (default:
                directory that contains the manifest)s--parttINTttypetdefaultis--skipmanifesttactiont
store_truesdo not upload the manifestcCs|j�tj|�dS(N(tconfigure_bundle_upload_authRt	configure(tself((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyR5s
c	
s|j��|j�tj|jd�}|jjd�pTtjj|jd�}x\|j	D]Q}tjj
||j�|_tjj|j�sat
dj|j���qaqaWtjdt�\}}tjdtd||f�}|j�|j�|j|�d|jjd��|j
�|jjd�s��tjj|jd�}tj|d	|jdd
|d|jjd�p�dd
|jjd
�p�d�}|j�nd}it�fd�|j	D��d6i|jdd6|d6fd6S(Ntmanifestt	directorysno such part: '{0}'tduplexttargettargst
show_progresstskipmanifesttsourcetdesttacls
aws-exec-readtretriesic3s9|]/}i|jd6�tjj|j�d6VqdS(tfilenametkeyN(Rtostpathtbasename(t.0tpart(t
key_prefix(sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pys	<genexpr>`stpartsRR t	manifests(tget_bundle_key_prefixtensure_dest_bucket_existsRtread_from_fileRtgetR!R"tdirnametimage_partstjoinRtisfilet
ValueErrortformattmultiprocessingtPipetFalsetProcesst_generate_bundle_partststarttclosetupload_bundle_partsR#Rt
from_othertmaintNonettuple(	RRtpart_dirR%t
part_out_rt
part_out_wtpart_gent
manifest_desttreq((R&sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyR<<s<




cCsb|jr.x"|dD]}dG|dGHqWn|ddddk	r^dG|dddGHndS(NR'tUploadedR R(i(tdebugR=(RtresultR%((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pytprint_resultgs
	(t__name__t
__module__tDESCRIPTIONRtTruetinttargparsetSUPPRESStARGSRR<RH(((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyR's			+cCs7z%x|jD]}|j|�q
WWd|j�XdS(N(R.tsendR9(Rt
out_mpconnR%((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyR7os(RNR3tos.pathR!trequestbuilderRtrequestbuilder.mixinsRteuca2ools.bundle.manifestRt euca2ools.commands.bundle.mixinsRteuca2ools.commands.s3Rteuca2ools.commands.s3.putobjectRRR7(((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyt<module>s	G