Current File : //usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyo
�
oB�]c@sddlZddlmZddlmZddlmZddlmZddlmZddl	m
Z
eje�Z
dZid
d6dd6ZdZdZdZdejfd��YZd�Zdd�Zedd�Zdd�Zdd�ZdS(i����N(tdistros(thelpers(tlog(tutil(tHostnameConf(tPER_INSTANCEsapt-gets(--option=Dpkg::Options::=--force-confolds*--option=Dpkg::options::=--force-unsafe-ios--assume-yess--quiett	eatmydatatcommandtautotenableds8# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
s'/etc/network/interfaces.d/50-cloud-inits/etc/default/localetDistrocBs�eZdZidd6dd6Ziiedd6ed6d6iedd6ed6ed	6d6Zd
�Zd�Zddd
�Z
d�Zd�Zd�Z
d�Zd�Zd�Zdd�Zd�Zd�Zddd�Zd�Zd�ZRS(s
/etc/hostnames'/etc/network/interfaces.d/50-cloud-inittenis/etc/netplan/50-cloud-init.yamltnetplanteni_patht
eni_headertnetplan_pathtnetplan_headertpostcmdscCsJtjj||||�tj|�|_d|_d|_d|_	dS(Ntdebiansen_US.UTF-8(
RR
t__init__RtRunnerst_runnertosfamilytdefault_localetNonet
system_locale(tselftnametcfgtpaths((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR:s
		cCs/|jst�|_n|jr(|jS|jS(s9Return the default locale if set, else use default locale(Rtread_system_localeR(R((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyt
get_localeDs	tLANGc		Cs�|st}n|s$td��n|j�}tjj|�}|jrQtnt}|j	�|j	�kpy|py|}|p�|p�|}|r�t
||d|�ntjd||j|�|r�t
||d|�d|_ndS(siApply specified locale to system, regenerate if specified locale
            differs from system default.sFailed to provide locale value.tkeynames9System has '%s=%s' requested '%s', skipping regeneration.N(tLOCALE_CONF_FNt
ValueErrorRtostpathtexistsRtFalsetTruetlowertregenerate_localetLOGtdebugtupdate_locale_confR(	Rtlocaletout_fnR!t
distro_localetconf_fn_existstsys_locale_unsett
need_regent	need_conf((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pytapply_localeOs$	
cCs!|j�|jdd|�dS(Ntinstalltpkgs(tupdate_package_sourcestpackage_command(Rtpkglist((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pytinstall_packagesms
cCst�|j|�S(N(t_maybe_remove_legacy_eth0t_supported_write_network_config(Rt	netconfig((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyt_write_network_configqscCs\t}x#|D]}|dkr
t}q
q
W|rEtjj|d�Stjj||�SdS(Ntalls--all(R'R(RR
t_bring_up_interfacet_bring_up_interfaces(Rtdevice_namestuse_alltd((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyRBus

cCsld}y|j|�}Wntk
r,nX|sBtd�}n|j|�tj|t|�d�dS(Nti�(Rt_read_hostname_conftIOErrorRtset_hostnameRt
write_filetstr(Rt
your_hostnameR/tconf((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyt_write_hostnames

cCs|j|j�}|j|fS(N(t_read_hostnamethostname_conf_fn(Rtsys_hostname((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyt_read_system_hostname�scCs#ttj|��}|j�|S(N(RRt	load_filetparse(RtfilenameRM((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyRG�s
cCsDd}y|j|�}|j}Wntk
r5nX|s@|S|S(N(RRGthostnameRH(RRUtdefaultRVRM((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyRO�s

cCsdS(Ns	127.0.1.1((R((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyt_get_localhost_ip�scCs#tjd|d|j|��dS(Nttzttz_file(Rtset_etc_timezonet
_find_tz_file(RRY((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pytset_timezone�sc	Cs�|dkrg}ntjj�}d|d<|jdt�}t|jdtd�|jdtd��}|jt	|jdt
���|r�t|t�r�|j
|�n%|r�t|t	�r�|j|�n|}|dkr�|jdd	�}n|j
|�tjd
|�}|j|�tjdtjdd
|dj|�fdtjd|fdi|d6td6�dS(NtnoninteractivetDEBIAN_FRONTENDtapt_get_wrapperRR	tapt_get_commandtupgradetapt_get_upgrade_subcommandsdist-upgrades%s=%stlogfunctmsgsapt-%s [%s]t tfunctargstkwargstenvtcapture(RR$tenvirontcopyt
get_optiontAPT_GET_WRAPPERt_get_wrapper_prefixtgettextendtlisttAPT_GET_COMMANDt
isinstanceRKtappendRtexpand_package_listtlog_timeR+R,tjointsubpR'(	RRRhR7tetwcfgtcmdtsubcmdR:((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR9�s0	
	

	cCs&|jjd|jdgdt�dS(Nsupdate-sourcestupdatetfreq(RtrunR9R(R((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR8�scCs+tjddg�\}}t|�j�S(Ntdpkgs--print-architecture(RRzRKtstrip(Rtarcht_err((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pytget_primary_arch�sN(t__name__t
__module__RPtnetwork_conf_fntNETWORK_FILE_HEADERR(trenderer_configsRRRR5R;R?RBRNRRRGRORXR]R9R8R�(((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR
,s2
	
				
	
				$	cCsqt|t�r!t|�g}ntj|�set|�j�dkri|dritj|d�ri|SgSdS(NRi(RuRKRtis_trueR)twhich(R}tmode((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyRp�s"s"/etc/network/interfaces.d/eth0.cfgcCs�tjj|�sdSd}y�tj|�}ddg}g|j�D]!}|jd�sG|j�^qG}||kr�tj|�d|}n|d|}Wnt	k
r�|d|}nXt
j|�dS(	saUbuntu cloud images previously included a 'eth0.cfg' that had
       hard coded content.  That file would interfere with the rendered
       configuration if it was present.

       if the file does not exist do nothing.
       If the file exists:
         - with known content, remove it and warn
         - with unknown content, leave it and warn
    Ns(Dynamic networking config may not apply.s	auto eth0siface eth0 inet dhcpt#sremoved %s with known contentss* '%s' exists with user configured content.s" %s exists, but could not be read.(R$R%R&RRSt
splitlinest
startswithR�tdel_filet	ExceptionR+twarning(R%tbmsgtcontentstknown_contentstftlinesRe((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR<�s!


R cCshd}|std|��ntjj|�rdtj|�}tj|�}|j|d�}n|S(s.Read system default locale setting, if presentRFsInvalid path: %s(R#R$R%R&RRStload_shell_contentRq(tsys_pathR!tsys_valtlocale_contenttsys_defaults((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR�scCsDtjd|||�tjdd|d||fgdt�dS(sUpdate system locale configs%Updating %s with locale setting %s=%ss
update-locales--locale-file=s%s=%sRkN(R+R,RRzR'(R.R�R!((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR-
s
	

cCsV|j�d	kr)tjd||�dStjd|�tjd|gdt�dS(
s�
    Run locale-gen for the provided locale and set the default
    system variable `keyname` appropriately in the provided `sys_path`.

    tcsc.utf-8tposixs$%s=%s does not require rengenerationNsGenerating locales for %ss
locale-genRk(R�sc.utf-8sposix(R)R+R,RRzR'(R.R�R!((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyR*s
(sapt-gets(--option=Dpkg::Options::=--force-confolds*--option=Dpkg::options::=--force-unsafe-ios--assume-yess--quiet(R$t	cloudinitRRRtloggingRt"cloudinit.distros.parsers.hostnameRtcloudinit.settingsRt	getLoggerR�R+RtRoR�tNETWORK_CONF_FNR"R
RpR<RR-R*(((s</usr/lib/python2.7/site-packages/cloudinit/distros/debian.pyt<module>s,
	�