Viewing File: /usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyo

ó
oBú]c@sßddlmZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lZejeƒZd
ejfd„ƒYZdd
dd	d„Zd„Zd„Zd	S(iÿÿÿÿ(tdistros(thelpers(tlog(tutil(tnet_util(tHostnameConf(tRendererNotFoundError(tPER_INSTANCENtDistrocBsØeZdZdZdZdgZiidd6dd6ed6d	6Zd
„Zdd„Z
d„Zd
„Zd„Z
d„Zd„Zd„Zd„Zd„Zd„Zdd„Zd„Zddd„Zd„ZRS(s/etc/locale.gens/etc/netctls/etc/resolv.conft	systemctls/etc/netplan/50-cloud-init.yamltnetplan_paths# generated by cloud-init
tnetplan_headertpostcmdstnetplancCsBtjj||||ƒtj|ƒ|_d|_d|d<dS(Ntarchtsshdtssh_svcname(RRt__init__RtRunnerst_runnertosfamily(tselftnametcfgtpaths((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR#s	cCsd|s|j}ntjdd|gdtƒtjƒd|dg}tj|dj|ƒƒdS(Ns
locale-gens-Gtcaptures	LANG="%s"ts
(tlocale_conf_fnRtsubptFalsetmake_headert
write_filetjoin(Rtlocaletout_fntlines((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pytapply_locale,s		cCs!|jƒ|jdd|ƒdS(NRtpkgs(tupdate_package_sourcestpackage_command(Rtpkglist((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pytinstall_packages8s
cCs/y|j|ƒSWntk
r*t‚nXdS(N(t_supported_write_network_configRtNotImplementedError(Rt	netconfig((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt_write_network_config<s
cCsGtj|ƒ}tjd||ƒt|d|jd|jd|jƒS(Ns3Translated ubuntu style network settings %s into %stresolv_conftconf_dirtenable_func(Rttranslate_networktLOGtdebugt_render_networktresolve_conf_fntnetwork_conf_dirt_enable_interface(Rtsettingstentries((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt_write_networkCs	
	cCsxdd|g}y;tj|ƒ\}}t|ƒrItjd||ƒnWn'tjk
rstjtd|ƒnXdS(Ntnetctltreenables(Running %s resulted in stderr output: %ss#Running interface command %s failed(RRtlenR2twarningtProcessExecutionErrortlogexc(Rtdevice_nametcmdt_outterr((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR7Ls	cCsdd|g}tjd||ƒy?tj|ƒ\}}t|ƒr\tjd||ƒntSWn(tjk
r‹tjtd|ƒt	SXdS(NR;trestarts8Attempting to run bring up interface %s using command %ss(Running %s resulted in stderr output: %ss#Running interface command %s failed(
R2R3RRR=R>tTrueR?R@R(RRARBRCRD((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt_bring_up_interfaceVs	
	
cCs(x!|D]}|j|ƒstSqWtS(N(RGRRF(Rtdevice_namestd((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt_bring_up_interfacesds
cCsud}y|j|ƒ}Wntk
r,nX|sBtdƒ}n|j|ƒtj|t|ƒddddƒdS(NRtomodetwtmodei¤(tNonet_read_hostname_conftIOErrorRtset_hostnameRRtstr(Rt
your_hostnameR"tconf((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt_write_hostnamejs

cCs|j|jƒ}|j|fS(N(t_read_hostnamethostname_conf_fn(Rtsys_hostname((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt_read_system_hostnamewscCs#ttj|ƒƒ}|jƒ|S(N(RRt	load_filetparse(RtfilenameRT((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyRO{s
cCsDd}y|j|ƒ}|j}Wntk
r5nX|s@|S|S(N(RNROthostnameRP(RR\tdefaultR]RT((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyRV€s

cCs#tjd|d|j|ƒƒdS(Nttzttz_file(Rtset_etc_timezonet
_find_tz_file(RR_((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pytset_timezone‹scCs½|dkrg}nddddg}|rLt|tƒrL|j|ƒn%|rqt|tƒrq|j|ƒn|r‡|j|ƒntjd|ƒ}|j|ƒtj|dt	ƒdS(Ntpacmans-Sys--quiets--noconfirms%s-%sR(
RNt
isinstanceRRtappendtlisttextendRtexpand_package_listRR(RtcommandtargsR%RBR(((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR'Žs	
cCs&|jjd|jdgdtƒdS(Nsupdate-sourcess-ytfreq(RtrunR'R(R((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR&£sN(t__name__t
__module__RR6R5tinit_cmdRFtrenderer_configsRRNR$R)R-R:R7RGRJRURYRORVRcR'R&(((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyRs.	
							
			
			t/s
etc/netctlsetc/resolv.confcCsfg}g}tj||ƒ}tj||ƒ}x|jƒD]\}}|dkr[q=n|j|ƒtjj||ƒ}	idd6|d6|jdƒd6d|jdƒ|jd	ƒfd
6|jdƒd6|jd
gƒd6}
tj|	t	|
ƒƒ|r|jdƒr||ƒnd
|kr=|j
|d
ƒq=q=W|rbtj|t|ƒƒn|S(snRender the translate_network format into netctl files in target.
    Paths will be rendered under target.
    tlotethernett
Connectiont	Interfacet	bootprototIPs%s/%staddresstnetmasktAddresstgatewaytGatewaysdns-nameserverstDNStauto(Rttarget_pathtitemsRftostpathR tgetRtconvert_netctlRhtconvert_resolv_conf(R9ttargetR/R.R0tdevstnameserverstdevtinfotnet_fntnet_cfg((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR4¨s4

	cCs™g}xƒt|ƒD]u}||}|dkr8d}n9t|ttfƒrqddjd„|Dƒƒd}n|jd||fƒqWdj|ƒS(sìGiven a dictionary, returns a string in netctl profile format.

    netctl profile is described at:
    https://git.archlinux.org/netctl.git/tree/docs/netctl.profile.5.txt

    Note that the 'Special Quoting Rules' are not handled here.Rt(t css|]}d|VqdS(s'%s'N((t.0tv((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pys	<genexpr>Ûst)s%s=%s
N(tsortedRNRettupleRgR Rf(R8tresulttkeytval((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR…Îs
	$cCs;d}t|tƒr7x|D]}|d|}qWn|S(s4Returns a settings string formatted for resolv.conf.Rsnameserver %s
(ReRg(R8R•tns((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyR†às

(t	cloudinitRRRtloggingRtcloudinit.distrosRt"cloudinit.distros.parsers.hostnameRtcloudinit.net.renderersRtcloudinit.settingsRR‚t	getLoggerRnR2RRNR4R…R†(((s:/usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyt<module>s%	
Back to Directory File Manager