Viewing 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.pyRGs
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,
	¨		
Back to Directory File Manager