
                            d Z ddlmZ ddlm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 dd	l	mZ dd
lmZ ddlmZ ddlmZ ddlZ ej(                  d      Zej-                  dddd       ej-                  dddd       ej-                  dddd       dZd Zedk(  r" ej4                         5   e        ddd       yy# 1 sw Y   yxY w)z@This package appends a tarball to an image in a Docker Registry.    )absolute_import)print_functionN)docker_creds)docker_name)append)docker_image)docker_session)logging_setup)patched)transport_poolz1Append tarballs to an image in a Docker Registry.)descriptionz--src-imagestorez*The name of the docker image to append to.T)actionhelprequiredz	--tarballzThe tarball to append.z--dst-imagezThe name of the new image.   c                     t        j                  t               t        j                         } t        j                  |        t        j                  t        j                  t              }t        j                  | j                        }t        j                  | j                        }t        j                  j                  |      }t!        j"                  d|       t%        j&                  |||      5 }t)        | j*                  d      5 }t-        j.                  ||j1                               }d d d        d d d        t        j                  j                  |      }t3        j4                  |||t        |j7                         g      5 }t!        j"                  d       |j9                         |j;                         }	t=        dj?                  ||	             d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)	N)args)sizezPulling v2.2 image from %r ...rb)threadsmountzStarting upload ...z*{name} was published with digest: {digest})namedigest) r
   DefineCommandLineArgsparser
parse_argsInitr   Httphttplib2_THREADSr   Tag	src_image	dst_imager   DefaultKeychainResolvelogginginfo
v2_2_imageFromRegistryopentarballr   Layerreadr	   Pushas_repositoryuploadr   printformat)
r   	transportsrcdstcredsr#   fnew_imgsessionr   s
             ;lib/third_party/containerregistry/tools/docker_appender_.pymainr<   4   s   %%f-				$$!!(--h?)
 	'#'# 
&
&
.
.s
3%	,,/5sE95	dllD	!QY1g 
" 6 
&
&
.
.s
3%3y("%"3"3"5!68;BLL&'NN7^^F	7>> ? ! #8 8	 
"	! 65
8 8s1   7G7%G+3G7AH+G4	0G77H H__main__)__doc__
__future__r   r   argparser'   containerregistry.clientr   r   containerregistry.client.v2_2r   r   r)   r	   containerregistry.toolsr
   r   containerregistry.transportr   r    ArgumentParserr   add_argumentr!   r<   __name__Httplib2     r;   <module>rK      s    G & %   1 0 0 D 8 1 + 6 	 	 	 C
E   	5	     K6N!  #   '(D   #@ zwF  s   8C

C