ó oBú]c@sšdZddlZyddlmZWn!ek rIddlmZnXddlZddlmZddgZd„Z d„Z d „Z d „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: : baseurl: name: enabled: # 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 ddt j ƒƒdj |ƒS(Nis# Created by cloud-init on %s t(Rt add_sectiontitemstsetRRtStringIOtwritetseekt readlinestinsertRt time_rfc2822R(R t repo_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ú|| |s