Viewing 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&