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

ó
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	
Back to Directory File Manager