Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundle.pyo |
�
��Xc @ s� d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m
Z
m Z d d l m
Z
d d l Z d d l m Z d d l m Z m Z m Z d d l m Z d
e e
e f d � � YZ d S( i����N( t Arg( t BaseCommand( t
ArgumentError( t FileTransferProgressBarMixint RegionConfigurableMixin( t Euca2ools( t BundleManifest( t
close_all_fdst open_pipe_fileobjst waitpid_in_thread( t UnbundleStreamt Unbundlec B s� e Z d Z e Z e d d d e d d d e d d �e d d
d d d d
d d �e d d d d d d
d d �e d d d d d d �g Z d � Z d � Z
d � Z d � Z RS( s� Recreate an image from its bundled parts
The key used to unbundle the image must match a certificate that was used to bundle it.s -ms
--manifestt typet metavart FILEt requiredt helps% the bundle's manifest file (required)s -ss --sourcet DIRt defaultt .sY directory containing the bundled image parts (default:
current directory)s -ds
--destinationsO where to place the unbundled image (default: current
directory)s -ks --privatekeys� file containing
the private key to decrypt the bundle with. This must match
a certificate used when bundling the image.c C sd t j | � | j � | j j d � s� | j j d � } | j j d � r] | | j d <q� d t j k r� t j d � | j d <q� | r� | | j d <q� t
d � � n t j j t j j
| j d � � | j d <t j j | j d � st
d j | j d � � � n t j j | j d � sFt
d j | j d � � � n | j j d | j d � t j j | j j d d
� � s�t
d j | j d � � � n t j j | j j d d
� � s�t
d j | j d � � � n t j j | j j d
d
� � s t
d j | j d
� � � n t j j | j j d
d
� � s`t
d j | j d
� � � n d S( Nt
privatekeys private-keyt
userregiont EC2_PRIVATE_KEYs. missing private key; please supply one with -ks% private key file '{0}' does not exists$ private key file '{0}' is not a files private key: %st sourceR s4 argument -s/--source: directory '{0}' does not exists. argument -s/--source: '{0}' is not a directoryt destinations9 argument -d/--destination: directory '{0}' does not exists3 argument -d/--destination: '{0}' is not a directory( R t configuret update_config_viewt argst gett configt get_user_optiont ost environt getenvR t patht
expandusert
expandvarst existst formatt isfilet logt debugt isdir( t selft config_privatekey( ( sF /usr/lib/python2.7/site-packages/euca2ools/commands/bundle/unbundle.pyR ? sB
! ! ! ! c
C s t d | g � x| j D]� } | j j d | j � t j � } t | j � �� } xJ t r� | j t
j � } | r� | j | � | j
| � | j � qW PqW Wt | j � d � } t | j d � } | | k r| j j d | | � t d j | j | | � � � n Wd QXq Wd S( Nt
except_fdss opening part '%s' for readingi sG rejecting unbundle due to part SHA1 mismatch (expected: %x, actual: %x)sL bundle part '{0}' appears to be corrupt (expected SHA1: {1:x}, actual: {2:x}( R t image_partsR( R) t filenamet hashlibt sha1t opent Truet readt euca2oolst BUFSIZEt updatet writet flusht intt hexdigestt errort RuntimeErrorR&