�
��Xc@s�ddlZddlZddlmZddlmZddlmZm Z ddl
Zddlm
Z
mZddlmZmZddlZddlmZddlmZdd lmZdd
lmZdeeee fd��YZdS(
i����N(tBaseCommand(tClientError(tFileTransferProgressBarMixintRegionConfigurableMixin(tcreate_bundle_pipelinetcopy_with_progressbar(tcreate_bundle_part_writertcreate_mpconn_aggregator(t Euca2ools(tBundleCreatingMixin(tBootstrapRequest(tmkdtemp_for_large_filestBundleImagecBsJeZeZdZdZejjZd�Z d�Z
d�Zd�ZRS(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�|jjddt�q�X||jd<n|jjd�r8|jjd�r8tj
d|jd|jj |j�}y|j�Wn't
k
r'|jjd dt�q8X||jd<n|j�|j�|j�|j�dS(
Ntbootstrap_servicetconfigtloglevelturlt
bootstrap_urlsFbootstrap service setup failed; auto cert fetching will be unavailabletexc_infotbootstrap_authsCbootstrap auth setup failed; auto cert fetching will be unavailable(tupdate_config_viewRt configuretargstgetR
t
SERVICE_CLASSRtlogtlevelRtdebugtTruet
AUTH_CLASStconfigure_bundle_credstconfigure_bundle_propertiestconfigure_bundle_outputtgenerate_encryption_keys(tselftservicetauth((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pyR8s4
c
Cs6|jjd�rhtjj|jd|jd�}tjj|jd�s�tj|jd�q�n+tdd�}tjj||jd�}|jj d|�|j
|�\}}|j||�}dj|�}t
|d��2}|j||jd|jd|jd �WdQXd
�|D�|ffS(Ntdestinationtprefixsbundle-sbundle path prefix: %ss{0}.manifest.xmltwt
privatekeytcerttec2certcss|]}|jVqdS(N(tfilename(t.0tpart((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pys <genexpr>vs(RRtostpathtjointexiststmkdirRRRt
create_bundletbuild_manifesttformattopentdump_to_file(R$tpath_prefixttempdirtdigesttpartinfotmanifesttmanifest_filenamet
manifest_file((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pytmain^scCs"x|dD]}dG|GHqWdS(NisWrote manifest((R$tresultR?((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pytprint_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 imagetlabeltmaxvaltimagetprogressbars 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
ValueErrorRRtRuntimeErrorR7trecvtEOFErrortinfotlenR0R1tdirname(R$R:ttarinfotbundle_in_rtbundle_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__RtSUITEtDESCRIPTIONt
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.utilRR(((sI/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/bundleimage.pyt<module>s |