ó ĄôXc@sőddlZddlZddlmZddlmZddlmZm Z ddl Z ddl m Z mZddlmZmZddlZ ddlmZddlmZdd lmZdd lmZd eeee fd „ƒYZdS( i˙˙˙˙N(t BaseCommand(t ClientError(tFileTransferProgressBarMixintRegionConfigurableMixin(tcreate_bundle_pipelinetcopy_with_progressbar(tcreate_bundle_part_writertcreate_mpconn_aggregator(t Euca2ools(tBundleCreatingMixin(tBootstrapRequest(tmkdtemp_for_large_filest BundleImagecBsJeZeZdZdZejjZd„Z d„Z d„Z d„Z RS(s%Prepare an image for use in the cloudtEUCA_DEFAULT_REGIONtAWS_DEFAULT_REGIONcCsd|jƒtj|ƒ|jjdƒs¤tjd|jd|jj d|jjdƒƒ}y|jƒWn't k r“|jj ddt ƒq¤X||jdvs(RRtostpathtjointexiststmkdirR RRt create_bundletbuild_manifesttformattopent dump_to_file(R$t path_prefixttempdirtdigesttpartinfotmanifesttmanifest_filenamet manifest_file((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pytmain^scCs"x|dD]}dG|GHq WdS(NisWrote manifest((R$tresultR?((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pyt print_resultysc Cs‚tj|jdƒ}|jd|_tjjjƒ\}}tjjjƒ\}}t|||jd|jd|d|j ƒ}|j ƒ|j ƒt |||jdd|j ƒ}|j ƒt |d|j ƒ} |j ƒ|jj dƒpůd} |jd | d |jdƒ} |jd f} yt| |d | ƒ} WnCtk r‰|jj d dtƒtdj|jdƒƒ‚nXWdQX|j ƒ| |jdkrĎtdj|jd| ƒƒ‚nzVy|jƒ}| jƒ}Wn3tk r#|jj ddtƒtdƒ‚nXWd|j ƒ| j ƒX|jjdt|ƒtjj|ƒƒ|jj d|ƒ||fS(NR(t image_sizetenc_keytenc_ivRt part_sizetprogressbar_labelsBundling imagetlabeltmaxvaltimaget progressbars error from copy_with_progressbarRsEcorrupt bundle: input size was larger than expected image size of {0}s]corrupt bundle: input size did not match expected image size (expected size: {0}, read: {1})s!EOFError from reading bundle infos.corrupt bundle: bundle process was interrupteds%i bundle parts written to %ssbundle digest: %s(ttarfiletTarInfoRtsizet euca2oolstbundletutiltopen_pipe_fileobjsRRtcloseRRRtget_progressbarRt ValueErrorRRt RuntimeErrorR7trecvtEOFErrortinfotlenR0R1tdirname(R$R:ttarinfot bundle_in_rt bundle_in_wtpartwriter_in_rtpartwriter_in_wtdigest_result_mpconntbundle_partinfo_mpconntbundle_partinfo_aggr_mpconnRItpbarRKt read_sizeR<R=((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pyR5~s\               (R R( t__name__t __module__RtSUITEt DESCRIPTIONt REGION_ENVVARR RtARGSRRARCR5(((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pyR .s  &  (tos.pathR0RMtrequestbuilder.commandRtrequestbuilder.exceptionsRtrequestbuilder.mixinsRRteuca2ools.bundle.manifestRPteuca2ools.bundle.pipes.coreRRteuca2ools.bundle.pipes.fittingsRRteuca2ools.bundle.utilteuca2ools.commandsRt euca2ools.commands.bundle.mixinsR teuca2ools.commands.bootstrapR teuca2ools.utilR R (((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pyts