Current File : //usr/lib/python2.7/site-packages/cloudinit/distros/arch.pyc
�
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	cCs�dd|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�%