ķ ĄôXc@s­ddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZde e efd „ƒ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„Z RS(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 `stpartsRR t manifests(tget_bundle_key_prefixtensure_dest_bucket_existsRtread_from_fileRtgetR!R"tdirnamet image_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__t DESCRIPTIONRtTruetinttargparsetSUPPRESStARGSRR<RH(((sJ/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/uploadbundle.pyR's    +cCsRz@x9|jD].}tjj|jƒs.t‚|j|ƒq WWd|jƒXdS(N(R.R!R"R0RtAssertionErrortsendR9(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.pyts    G