
    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KJr  S	/ S
Q\S/S.r\\S'   \R$                  " \5      rS\S\4S jrS rS rS\S\S\	S\SS4
S jrg)z<Yum Add Repo: Add yum repository configuration to the system    N)ConfigParser)util)Cloud)Config)
MetaSchema)PER_INSTANCEcc_yum_add_repo)	almalinux
azurelinuxcentos
cloudlinux	eurolinuxfedoramariner	openeulerOpenCloudOSopenmandrivaphotonrhelrocky	TencentOS	virtuozzo	yum_repos)iddistros	frequencyactivate_by_schema_keysmetarepo_idreturnc                 &    U R                  SS5      $ )aN  Canonicalize repo id.

The sole name convention for repo ids is to not contain namespaces,
and typically the separator used is `-`. More info:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-setting_repository_options

:param repo_id: Repo id to convert.
:return: Canonical repo id.
 -)replace)r   s    B/usr/lib/python3/dist-packages/cloudinit/config/cc_yum_add_repo.py_canonicalize_idr&   /   s     ??3$$    c                 .   [        U [        5      (       a  [        [        U 5      5      $ [        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
)
isinstanceboolstrintlisttuplejoin_format_repo_value)valvs     r%   r1   r1   <   st    #3s8}#e}%% yy=A,Q/=>>c33xJ >s   Bc                    [        5       nUR                  U 5        UR                  5        H   u  p4UR                  X[	        U5      5        M"     [
        R                  " 5       nUR                  U5        UR                  S5        UR                  5       nUR                  SS[        R                  " 5       -  5        SR                  U5      $ )Nr   z# Created by cloud-init on %s
 )r   add_sectionitemssetr1   ioStringIOwriteseek	readlinesinsertr   time_rfc2822r0   )r   repo_configto_bekr3   to_be_streamliness          r%   _format_repository_configrE   K   s    NE	g!!# 			'034 $ ;;=L	KKa""$E	LL59J9J9LMN775>r'   namecfgcloudargsc                    UR                  S5      nU(       d  [        R                  SU 5        g [        R                  " USS5      n0 n0 nUR                  5        GHL  u  p[        U5      n
[        R                  R                  USU
-  5      n[        R                  R                  U5      (       a  [        R                  SUU5        Mq  X;   a  [        R                  SUU5        M  U	(       d  0 n	0 nU	R                  5        H@  u  pUR                  5       R                  5       R                  SS	5      nU(       d  M<  XU'   MB     Un	S
n/ SQnU H  nUU	;  d  M  US-  nM     U[        U5      :X  a)  [        R!                  SUSR                  U5      5        GMD  XU
'   XU
'   GMO     UR                  5        H8  u  nn[#        UUR                  U5      5      n[        R$                  " UU5        M:     g )Nr   z<Skipping module named %s, no 'yum_repos' configuration foundyum_repo_dirz/etc/yum.repos.d/z%s.repoz)Skipping repo %s, file %s already exists!z*Skipping repo %s, file %s already pending!r#   _r   )baseurlmetalink
mirrorlist   z^Repository %s should contain atleast one of the following configuration entries: %s, skipping!z, )getLOGdebugr   get_cfg_option_strr7   r&   ospathr0   existsinfolowerstripr$   lenwarningrE   
write_file)rF   rG   rH   rI   reposrepo_base_pathrepo_locationsrepo_configsr   r@   canon_repo_idrepo_fn_pthn_repo_configrB   r3   missing_required
req_fields	req_field	c_repo_idrV   	repo_blobs                        r%   handlerj   [   s   GGK E		J	
 	,,^0N NL %(1ggll>93NO77>>+&&HH;
 ,HH<
 K%%'DA	!))#s3Aq#$a  ( $:
#I+ A%  $ s:.KKB		*%	 +6',7=)S !.V *//1	4-|''	2
	 	i(	 2r'   )__doc__r9   loggingrU   configparserr   	cloudinitr   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.settingsr   r   __annotations__	getLogger__name__rR   r,   r&   r1   rE   r.   rj    r'   r%   <module>rw      s    C 	  	 %  ! # . + "  +})j 0 !
%c 
%c 
%
 <) <)6 <)% <)t <) <)r'   