Viewing File: /usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyc
ó
oBú]c @ sš d Z d d l Z y d d l m Z Wn! e k
rI d d l m Z n Xd d l Z d d l m Z d d g Z d „ Z d „ Z
d „ Z d
„ Z d S( 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( t utilt fedorat rhelc C s. | j ƒ j d d ƒ } | j d d ƒ } | S( Nt -t _t ( t lowert replace( t repo_id( ( sD /usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyt _canonicalize_id. s c C sz t | t ƒ r t t | ƒ ƒ St | t t f ƒ rZ d j g | D] } t | ƒ ^ qA ƒ St | t j ƒ sv t | ƒ S| S( Ns
(
t
isinstancet boolt strt intt listt tuplet joint _format_repo_valuet sixt string_types( t valt v( ( sD /usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyR 4 s &
c C s¥ t ƒ } | j | ƒ x3 | j ƒ D]% \ } } | j | | t | ƒ ƒ q# Wt j ƒ } | j | ƒ | j d ƒ | j ƒ } | j
d d t j ƒ ƒ d j
| ƒ S( Ni s # Created by cloud-init on %s
t ( R t add_sectiont itemst setR R t StringIOt writet seekt readlinest insertR t time_rfc2822R ( R t repo_configt to_bet kR t to_be_streamt lines( ( sD /usr/lib/python2.7/site-packages/cloudinit/config/cc_yum_add_repo.pyt _format_repository_configC s
c C s | j d ƒ } | s) | j d | ƒ d St j | d d ƒ } i } i } xn| j ƒ D]`\ } }
t | ƒ } t j j | d | ƒ } t j j | ƒ r³ | j
d | | ƒ qW n% | | k rØ | j
d | | ƒ qW n |
sç i }
n i }
xK |
j ƒ D]= \ } } | j ƒ j ƒ j
d d ƒ } | rú | |
| <qú qú W|
}
d
} x= d g D]2 } | |
k rQ| j d | | ƒ | d
7} qQqQW| s¤|
| | <| | | <qW | j d | | ƒ qW WxB | j ƒ D]4 \ } } t | | j | ƒ ƒ } t j | | ƒ qÈWd S( Nt yum_reposs<