Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundlestream.pyo
�
��Xc@s�ddlZddlZddlmZddlmZddlmZm	Z	ddl
Z
ddlmZm
Z
ddlmZddlmZddlmZd	eee	fd
��YZdS(i����N(tArg(tBaseCommand(tFileTransferProgressBarMixintRegionConfigurableMixin(tcreate_unbundle_pipelinetcopy_with_progressbar(topen_pipe_fileobjs(t	Euca2ools(tfilesizetUnbundleStreamcBs�eZdZeZeddddddd�eddddddd	�ed
dddedd
�eddddedd�eddddedd�eddddd�gZd�Z	d�Z
RS(s�Recreate an image solely from its combined bundled parts without using a manifest

Usually one would want to use euca-unbundle instead.s-itdesttsourcetmetavartFILEthelps-file to read the bundle from (default: stdin)s-os6file to write the unbundled image to (default: stdout)s	--enc-keytHEXtrequiredsGthe
                symmetric key used to encrypt the bundle (required)s--enc-ivsOthe initialization vector used to encrypt the bundle
                (required)s--image-sizetBYTESttypes,verify the unbundled image is a certain sizes
--sha1-digestsXverify the image's
                contents against a SHA1 digest from its manifest filecCs!tj|�|j�|jjd�s=|jddkrhtjtjtj	j
���|jd<n6t|jdtj
�r�t|jd�|jd<n|jjd�s�|jddkr�tj|jd<t|jd<n9t|jdtj
�rt|jdd�|jd<ndS(NRt-R
t
show_progresstw(Rt	configuretupdate_config_viewtargstgettostfdopentduptsyststdintfilenot
isinstancetsixtstring_typestopentstdouttFalse(tself((sL/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundlestream.pyR?s

&+&c	Csz|jd|jjd��}t�\}}t|jd||jd|jdd|j�}|j�t||jdd|�}t|j	�d	�}|j�t|jjd
�p�dd	�}|jjd�}|r||kr|j
jd||�td
j
||���n|jjd�}|rp||krp|j
jd||�tdj
||���n||fS(Ntmaxvalt
image_sizeRtenc_keytenc_ivtdebugR
tprogressbaritsha1_digestt0sGrejecting unbundle due to SHA1 mismatch (expected SHA1: %x, actual: %x)sBbundle appears to be corrupt (expected SHA1: {0:x}, actual: {1:x})sBrejecting unbundle due to size mismatch (expected: %i, actual: %i)s>bundle appears to be corrupt (expected size: {0}, actual: {1})(tget_progressbarRRRRR+tcloseRtinttrecvtlogterrortRuntimeErrortformat(	R&tpbartunbundle_out_rtunbundle_out_wtunbundle_sha1_rtactual_sizetactual_sha1t
expected_sha1t
expected_size((sL/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundlestream.pytmainQs0
	
!
	
	(t__name__t
__module__tDESCRIPTIONRtSUITERtTrueRtARGSRR?(((sL/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundlestream.pyR	*s 	(tos.pathRRtrequestbuilderRtrequestbuilder.commandRtrequestbuilder.mixinsRRR!teuca2ools.bundle.pipes.coreRRteuca2ools.bundle.utilRteuca2ools.commandsRteuca2ools.commands.argtypesRR	(((sL/usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundlestream.pyt<module>s