Viewing File: /usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyc

ó
oBú]c@sšdZddlZyddlmZWn!ek
rIddlmZnXddlZddlmZddgZd„Z	d„Z
d	„Zd
„ZdS(s²
Yum Add Repo
------------
**Summary:** add yum repository configuration to the system

Add yum repository configuration to ``/etc/yum.repos.d``. Configuration files
are named based on the dictionary key under the ``yum_repos`` they are
specified with. If a config file already exists with the same name as a config
entry, the config entry will be skipped.

**Internal name:** ``cc_yum_add_repo``

**Module frequency:** per always

**Supported distros:** fedora, rhel

**Config keys**::

    yum_repos:
        <repo-name>:
            baseurl: <repo url>
            name: <repo name>
            enabled: <true/false>
            # any repository configuration options (see man yum.conf)
iÿÿÿÿN(tConfigParser(tutiltfedoratrhelcCs.|jƒjddƒ}|jddƒ}|S(Nt-t_t (tlowertreplace(trepo_id((sD/usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyt_canonicalize_id.scCszt|tƒrtt|ƒƒSt|ttfƒrZdjg|D]}t|ƒ^qAƒSt|tj	ƒsvt|ƒS|S(Ns
(
t
isinstancetbooltstrtinttlistttupletjoint_format_repo_valuetsixtstring_types(tvaltv((sD/usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyR4s&
cCs¥tƒ}|j|ƒx3|jƒD]%\}}|j||t|ƒƒq#Wtjƒ}|j|ƒ|jdƒ|j	ƒ}|j
ddtjƒƒdj
|ƒS(Nis# Created by cloud-init on %s
t(Rtadd_sectiontitemstsetRRtStringIOtwritetseekt	readlinestinsertRttime_rfc2822R(R	trepo_configtto_betkRtto_be_streamtlines((sD/usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyt_format_repository_configCs	


cCs|jdƒ}|s)|jd|ƒdStj|ddƒ}i}i}xn|jƒD]`\}	}
t|	ƒ}tjj|d|ƒ}tjj	|ƒr³|j
d|	|ƒqWn%||krØ|j
d|	|ƒqWn|
sçi}
ni}
xK|
jƒD]=\}}|jƒjƒj
dd	ƒ}|rú||
|<qúqúW|
}
d
}x=dgD]2}||
krQ|jd|	|ƒ|d
7}qQqQW|s¤|
||<|||<qW|jd|	|ƒqWWxB|jƒD]4\}}t||j|ƒƒ}tj||ƒqÈWdS(Nt	yum_reposs<Skipping module named %s, no 'yum_repos' configuration foundtyum_repo_dirs/etc/yum.repos.d/s%s.repos)Skipping repo %s, file %s already exists!s*Skipping repo %s, file %s already pending!RRitbaseurlsBRepository %s does not contain a %s configuration 'required' entryis6Repository %s is missing %s required fields, skipping!(tgettdebugRtget_cfg_option_strRR
tostpathRtexiststinfoRtstripRtwarningR&t
write_file(tnametcfgt_cloudtlogt_argstrepostrepo_base_pathtrepo_locationstrepo_configsR	R!t
canon_repo_idtrepo_fn_ptht
n_repo_configR#Rtmissing_requiredt	req_fieldt	c_repo_idR.t	repo_blob((sD/usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pythandleSsV			
	
		


	(
t__doc__R-tconfigparserRtImportErrorRt	cloudinitRtdistrosR
RR&RD(((sD/usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyt<module>s
			
Back to Directory File Manager