Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/euimage/installpackedimage.pyc
�
��Xc@s�ddlZddlZddlZddlmZddlmZddlmZm	Z	ddl
Z
ddlmZddl
mZddlmZdeee	fd	��YZdS(
i����N(tArg(t
HmacV4Auth(tFileTransferProgressBarMixintTabifyingMixin(tEC2(t	ImagePack(t	S3RequesttInstallPackedImagecBs+eZdZeddddd�eddd�edd	dd
dd�eddd
�eddddd�eddddd�eddddd�eddddd�eddddd�eddddd�eddd�eddej�eddej�g
Zd �Zd!�Zd"�Z	RS(#s9***TECH PREVIEW***

Install a packed image into the cloudt
pack_filenametmetavartFILEthelpsthe pack to install (required)s	--profilesMwhich of the image's profiles to
                install (default: "default")s-bs--bucketsBUCKET[/PREFIX]s(bucket to upload the image to (required)s
--locations�location constraint of the destination
                bucket (default: inferred from s3-location-constraint in
                configuration, or otherwise nones--privatekeys�file containing
                your private key to sign the bundle's manifest with.  This
                private key will also be required to unbundle the bundle in
                the future.  (instance-store only)s--certsLfile containing your
                X.509 certificate (instance-store only)s	--ec2certsSfile containing the
                cloud's X.509 certificate (instance-store only)s--usertACCOUNTs%your account ID (instance-store only)s--kerneltIMAGEs^ID of the kernel image to
                associate with this machine image (paravirtual only)s	--ramdisks_ID of the ramdisk image
                to associate with this machine image (paravirtual only)s	--ec2-urlscompute service endpoint URLs
--ec2-auths
--ec2-servicecCs�tj|�|jjd�sMtj|jd|jjd��|jd<n|jjd�s{tj|j�|jd<n|jjd�s�d|jd<ndS(Ntec2_serviceturltec2_urltec2_authtprofiletdefault(	Rt	configuretargstgetRt
from_othertserviceRtauth(tself((sQ/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/installpackedimage.pyRIs
(c

Cs�ii|jd6|jd6d6i|jdd6|jdd6d6}tj�}tj|jd���}|jd|jjkr�t	d	j
|jdd
j|jjj�����n|j
���}tj�}d}|jdd
d|jj�}|j�x]tra|jtj�}|s'Pn|j|�|j|�|t|�7}|j|�qW|j�WdQX|j�|jjkr�td|jj|j���n|jd�|jj |jd|||jj|j�}	|j!�WdQX|	S(NRRts3RRtec2RRs(no such profile: "{0}" (choose from {1})s, itlabelt
Decompressingtmaxvals?image appears to be corrupt (expected SHA256: {0}, actual: {1})("RRRttempfilet
TemporaryFileRtopentimage_mdtprofilest
ValueErrortformattjointkeyst
open_imagethashlibtsha256tget_progressbartpack_mdt
image_sizetstarttTruetreadt	euca2oolstBUFSIZEtupdatetwritetlentfinisht	hexdigesttimage_sha256sumtRuntimeErrortseektinstall_profiletclose(
Rtservicestunpacked_imagetpacktimagetdigestt
bytes_writtentpbartchunktimage_id((sQ/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/installpackedimage.pytmainTsF
$
	

	
	cCs|jd|f�GHdS(NR
(ttabify(RRF((sQ/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/installpackedimage.pytprint_result�s(
t__name__t
__module__tDESCRIPTIONRtargparsetSUPPRESStARGSRRGRI(((sQ/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/installpackedimage.pyR(s6				,(RMR*R trequestbuilderRtrequestbuilder.auth.awsRtrequestbuilder.mixinsRRR2teuca2ools.commands.ec2Rteuca2ools.commands.euimage.packRteuca2ools.commands.s3RR(((sQ/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/installpackedimage.pyt<module>s