
    x[h              
           % S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  S/ S	Q\S
/S.r\\S'   \R                   " \5      rS rS rS rS rS rS\S\	S\S\SS4
S jrg)z6zypper_add_repo: Add zypper repositories to the system    N)util)Cloud)Config)
MetaSchema)
PER_ALWAYScc_zypper_add_repo)opensusezopensuse-microoszopensuse-tumbleweedzopensuse-leapsle_hpcz	sle-microsleszypper)iddistros	frequencyactivate_by_schema_keysmetac                 *    U R                  SS5      n U $ )N _)replace)repo_ids    E/usr/lib/python3/dist-packages/cloudinit/config/cc_zypper_add_repo.py_canonicalize_idr   %   s    ooc3'GN    c                    [        U [        5      (       a  U (       a  S$ S$ [        U [        [        45      (       a+  SR	                  U  Vs/ s H  n[        U5      PM     sn5      $ [        U [        5      (       d  [        U 5      $ U $ s  snf )N   r   z
    )
isinstanceboollisttuplejoin_format_repo_valuestr)valvs     r   r!   r!   *   sr    #tqQ#e}%%}}SAS03SABBc33xJ Bs   B	c                     [         R                  " 5       n0 X '   UR                  5        H  u  p4[        U5      X    U'   M     UR	                  5       nSR                  U5      $ )N
)	configobj	ConfigObjitemsr!   writer    )r   repo_configto_bekr$   liness         r   _format_repository_configr/   5   s[    !EEN!!# /q1q $ KKME99Ur   c                    U (       d  g0 n[        U 5       GH-  u  p4[        SS/5      R                  [        U5      5      nU(       a(  [        R	                  SUSR                  U5      5        MZ  UR                  S5      n[        U5      n[        R                  R                  USU-  5      n[        R                  R                  U5      (       a  [        R                  SUU5        M  Xb;   a  [        R                  SUU5        M  [        S	 UR                  5        5       5      n	S
 H  n
X;  d  M
  SX'   M     X4X&'   GM0     UR                  5        H-  u  pk[        XkS   5      n[        R                   " US   U5        M/     g)zWrite the user-provided repo definition files
@param repos: A list of repo dictionary objects provided by the user's
    cloud config.
@param repo_base_path: The directory path to which repo definitions are
    written.
Nr   baseurlz;Repo config at index %d is missing required config keys: %s,z%s.repoz)Skipping repo %s, file %s already exists!z*Skipping repo %s, file %s already pending!c              3      #    U  HH  u  pU(       d  M  US :w  d  M  UR                  5       R                  5       R                  SS5      U4v   MJ     g7f)r   -r   N)lowerstripr   ).0r-   r$   s      r   	<genexpr>_write_repos.<locals>.<genexpr>i   sI      
0 5$Y 5QWWY__&&sC0!40s   AA7A)enabledautorefresh1r   )	enumerateset
differenceLOGwarningr    getr   ospathexistsinfodictr)   r/   r   
write_file)reposrepo_base_pathvalid_reposindexuser_repo_configmissing_keysr   canon_repo_idrepo_fn_pthr+   field	repo_data	repo_blobs                r   _write_reposrU   A   sj    K#,U#3D),-88=M9NOKKM&
 "&&t,(1ggll>93NO77>>+&&HH;
 #HH<
   
(..0
 
 0E'%(" 0 !,9Q $4T *//1-g}E		!i0 2r   c                 ~   U (       d  gSn[         R                  " U5      nS/nU R                  5        HJ  u  pEUS:X  a  SnUS-  n[        R	                  U5        M)  U(       d  M2  UR                  U< SU< 35        ML     [        U5      S:  a  US	R                  U5      -   nOUn[         R                  " X5        g)
z@Write to the default zypp configuration file /etc/zypp/zypp.confNz/etc/zypp/zypp.confz# Added via cloud.cfg	configdirz5Changing the location of the zypper configuration is z+not supported, skipping "configdir" setting=r   r&   )	r   load_text_filer)   rA   rB   appendlenr    rI   )zypper_configzypp_configzypp_conf_contentnew_settingssettingvaluemsg
new_configs           r   _write_zypp_configrd   {   s    'K++K8+,L'--/k!IC@@CKK57E :; 0 <1&<)@@
&
OOK,r   namecfgcloudargsreturnc                 4   UR                  S5      nU(       d  [        R                  SU 5        g UR                  S5      nU(       d  [        R                  SU 5        g UR                  S0 5      nUR                  SS5      n[        U5        [	        XW5        g )Nr   zBSkipping module named %s, no 'zypper' relevant configuration foundrJ   z8Skipping module named %s, no 'repos' configuration foundconfigreposdirz/etc/zypp/repos.d/)rC   rA   debugrd   rU   )re   rf   rg   rh   zypper_sectionrJ   r\   rK   s           r   handlero      s    WWX&N		8	

 	w'E		F	
 	"&&x4M"&&z3GHN}%'r   )__doc__loggingrD   r'   	cloudinitr   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.settingsr   r   __annotations__	getLogger__name__rA   r   r!   r/   rU   rd   r"   r   ro    r   r   <module>r{      s    =  	   ! # . )   (zj  !
	71t-,( (6 (% (t ( (r   