Current File : //lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyo
�
oB�]c
@s�dZddlZddlZddlmZddlmZddlmZddl	m
Zddlm
Z
ddl	mZd	d
gZi	dd6d
d6dd6ed�d6ed6ed�gd6e
d6dd6iidd6iidd6idd6iidd6ed�d6d6idd6dd6dd6d6d 6ddgd!6ed"6d#6d$d%6d&6idd6ed'�d6d(6d 6gd!6d$d)6ed"6d*6d 6Zee�Zeje�Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�ZdS(1s5zypper_add_repo: Add zyper repositories to the systemi����N(tstring_types(tdedent(tget_schema_doc(tlog(t
PER_ALWAYS(tutiltopensusetslestcc_zypper_add_repotidt
ZypperAddRepotnames5Configure zypper behavior and add zypper repositoriesttitles        Configure zypper behavior by modifying /etc/zypp/zypp.conf. The
        configuration writer is "dumb" and will simply append the provided
        configuration options to the configuration file. Option settings
        that may be duplicate will be resolved by the way the zypp.conf file
        is parsed. The file is in INI format.
        Add repositories to the system. No validation is performed on the
        repository file entries, it is assumed the user is familiar with
        the zypper repository file format.tdescriptiontdistross�        zypper:
          repos:
            - id: opensuse-oss
              name: os-oss
              baseurl: http://dl.opensuse.org/dist/leap/v/repo/oss/
              enabled: 1
              autorefresh: 1
            - id: opensuse-oss-update
              name: os-oss-up
              baseurl: http://dl.opensuse.org/dist/leap/v/update
              # any setting per
              # https://en.opensuse.org/openSUSE:Standards_RepoInfo
              # enable and autorefresh are on by default
          config:
            reposdir: /etc/zypp/repos.dir
            servicesdir: /etc/zypp/services.d
            download.use_deltarpm: true
            # any setting in /etc/zypp/zypp.conf
    texamplest	frequencytobjectttypetarraytstrings�                                    The unique id of the repo, used when
                                     writing
                                    /etc/zypp/repos.d/<id>.repo.turitformatsThe base repositoy URLtbaseurlt
propertiestrequiredtadditionalPropertiestitemsitminItemstrepossn                        Any supported zypo.conf key is written to
                        /etc/zypp/zypp.conf'tconfigt
minPropertiestzyppercCs|jdd�}|S(Nt t_(treplace(trepo_id((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyt_canonicalize_idfscCsut|t�r|rdSdSt|ttf�rXdjg|D]}t|�^q?�St|t�sqt|�S|S(Niis
    (t
isinstancetbooltlistttupletjoint_format_repo_valueRtstr(tvaltv((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyR+ks&
cCs`tj�}i||<x.|j�D] \}}t|�|||<q#W|j�}dj|�S(Ns
(t	configobjt	ConfigObjRR+twriteR*(R$trepo_configtto_betkR.tlines((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyt_format_repository_configvs
c
Cs�|s
dSi}xCt|�D]5\}}tddg�jt|��}|rrtjd|dj|��qn|jd�}t|�}tj	j|d|�}tj	j
|�r�tjd||�qn%||kr�tjd||�qntd	�|j
�D��}	x-d
dgD]}
|
|	krd|	|
<qqW||	f||<qWxA|j
�D]3\}}t||d
�}tj|d|�qcWdS(s�Write 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	Rs;Repo config at index %d is missing required config keys: %st,s%s.repos)Skipping repo %s, file %s already exists!s*Skipping repo %s, file %s already pending!cssK|]A\}}|r|dkr|j�j�jdd�|fVqdS(R	t-R"N(tlowertstripR#(t.0R4R.((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pys	<genexpr>�s	tenabledtautorefresht1i����i(t	enumeratetsett
differencetLOGtwarningR*tgetR%tostpathtexiststinfotdictRR6Rt
write_file(
Rtrepo_base_pathtvalid_repostindextuser_repo_configtmissing_keysR$t
canon_repo_idtrepo_fn_pthR2tfieldt	repo_datat	repo_blob((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyt_write_repos�s>!	
	
cCs�|s
dSd}tj|�}dg}xi|j�D][\}}|dkrpd}|d7}tj|�q5n|r5|jd||f�q5q5Wt|�dkr�|d	j|�}n|}tj||�dS(
s@Write to the default zypp configuration file /etc/zypp/zypp.confNs/etc/zypp/zypp.confs# Added via cloud.cfgt	configdirs5Changing the location of the zypper configuration is s+not supported, skipping "configdir" settings%s=%sis
(	Rt	load_fileRRBRCtappendtlenR*RJ(t
zypper_configtzypp_configtzypp_conf_contenttnew_settingstsettingtvaluetmsgt
new_config((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyt_write_zypp_config�s"	

c	Cs�|jd�}|s)tjd|�dS|jd�}|sRtjd|�dS|jdi�}|jdd�}t|�t||�dS(NR sBSkipping module named %s, no 'zypper' relevant configuration foundRs8Skipping module named %s, no 'repos' configuration foundRtreposdirs/etc/zypp/repos.d/(RDRBtdebugRbRU(	Rtcfgt_cloudRt_argstzypper_sectionRRZRK((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pythandle�s		
(t__doc__R/REtsixRttextwrapRtcloudinit.config.schemaRt	cloudinitRtloggingtcloudinit.settingsRRRtTruetFalsetschemat	getLoggert__name__RBR%R+R6RURbRi(((sG/usr/lib/python2.7/site-packages/cloudinit/config/cc_zypper_add_repo.pyt<module>sn


				1