
    _                     "   d Z 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 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mZ ddlZ ej2                  d      Zej7                  dddd       ej7                  dddd        ej8                  e       ej7                  ddd       ej7                  ddd       dZd Zedk(  r" ej@                         5   e        ddd       yy# 1 sw Y   yxY w) zmThis package pulls images from a Docker Registry.

Unlike docker_puller the format this uses is proprietary.
    N)docker_creds)docker_name)docker_image)docker_http)docker_image_list)save)	v2_compat)logging_setup)patched)platform_args)retry)transport_poolz-Pull images from a Docker Registry, faaaaast.)descriptionz--namestorezaThe name of the docker image to pull and save. Supports fully-qualified tag or digest references.T)actionhelprequiredz--directoryz Where to save the image's files.z--client-config-dirzrThe path to the directory where the client configuration files are located. Overiddes the value from DOCKER_CONFIG)r   r   z--cachezImage's files cache directory.   c                     t        j                  t               t        j                         } t        j                  |        t        j                         }|j                  t        j                        }t        j                  |j                  t              }d| j                  v r t        j                  | j                        }nt        j                   | j                        }| j"                  )t$        j&                  j)                  | j"                         t*        j,                  }	 t$        j&                  j/                  |      }	 t3        j:                  d|       t=        j>                  ||      5 }|jA                         rjtC        jD                  |       }|jG                  |      5 }	tI        jJ                  |	| jL                  t        | jN                         	 d d d        d d d        y d d d        t3        j:                  d|       tQ        j>                  ||||      5 }
|
jA                         r;tI        jJ                  |
| jL                  t        | jN                         	 d d d        y 	 d d d        t3        j:                  d	|       tS        j>                  |||      5 }tU        jV                  |      5 }
tI        jJ                  |
| jL                  t        | jN                         	 d d d        d d d        y # t0        $ r7}t3        j4                  d||       t7        j8                  d       Y d }~d }~ww xY w# 1 sw Y   _xY w# 1 sw Y   dxY w# 1 sw Y   xY w# 1 sw Y   nxY w	 d d d        y # 1 sw Y   y xY w# t0        $ r6}t3        j4                  d
||       t7        j8                  d       Y d }~y d }~ww xY w)N)args)size@z&Error resolving credentials for %s: %s   z!Pulling manifest list from %r ...)threadscache_directoryzPulling v2.2 image from %r ...zPulling v2 image from %r ...z%Error pulling and saving image %s: %s),r
   DefineCommandLineArgsparser
parse_argsInitr   FactoryWithSourceTransportCallablehttplib2Httpr   Build_THREADSnamer   DigestTagclient_config_dirr   DefaultKeychainsetCustomConfigDirr   SUPPORTED_MANIFEST_MIMESResolve	Exceptionloggingfatalsysexitinfo
image_listFromRegistryexistsr   FromArgsresolver   fast	directorycache
v2_2_imagev2_imager	   	V22FromV2)r   retry_factory	transportr&   acceptcredseimg_listplatformdefault_childv2_2_imgv2_imgs               7lib/third_party/containerregistry/tools/fast_puller_.pymainrJ   C   s   %%f-				$$--/-;;HMMJ-!!-"5"5HE)DIIdii(D??499%D 
'  33D4J4JK //&((006E%LL4d;		 	 ui	8H		 ))$/h'=
))nn"jj	*
  (	 
9	8	8 LL148		 	 ui	@H				NN JJ		(
 	 
A	@	 
A LL/6			tUI	6&v&(		NN JJ		(
 	 ' 
7	6= 
 MM:D!DHHQKK ('	 
9	8 
A	@ '&& 
7	6	6 
 MM94CHHQKKs   /L	 -N <7M33M&M.N 76N -AM&0N :5N /N3M28N N 		M	,MM	M	MM#N &M/+N 2M;	7N?N NN N 	O,OO__main__)!__doc__argparser/   r1   containerregistry.clientr   r   containerregistry.client.v2r   r=   containerregistry.client.v2_2r   r<   r   r4   r   r	   containerregistry.toolsr
   r   r   containerregistry.transportr   r   r"   ArgumentParserr   add_argumentAddArgumentsr%   rJ   __name__Httplib2     rI   <module>rZ      s'  
   
 1 0 @ 5 D I . 3 1 + 1 - 6  
!	 	 ?
A   ?     '(K     6 "   
6  7
   g$E  G JZ zwF  s   3DD