404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.191.195.57: ~ $
3

\�met$�@spddlZddlmZmZmZmZddlmZmZddl	m
Z
ddlmZej
e�ZGdd�dej�Zdd	�ZdS)
�N)�distros�helpers�subp�util)�PackageList�net_util)�HostnameConf)�PER_INSTANCEc@s�eZdZdZdZdZdZdgZdZddgZ	d	d
�Z
d'dd
�Zed�dd�Z
dd�Zedd��Zdd�Zdd�Zdd�Zdd�Zedd��Zd(dd �Zd!d"�Zd)d#d$�Zd%d&�ZdS)*�Distroz/etc/env.d/02localez/etc/locale.genz/etc/conf.d/netz/etc/conf.d/hostnamez
rc-servicezen_US.UTF-8zC.UTF8 UTF-8zen_US.UTF-8 UTF-8cCsBtjj||||�tj|�|_d|_d|d<tj�r>tj	d�dS)NZgentooz/etc/init.d/sshdZssh_svcnamez/Cloud-init does not support systemd with gentoo)
rr
�__init__rZRunners�_runnerZosfamilyZuses_systemd�LOG�error)�self�nameZcfg�paths�r�/usr/lib/python3.6/gentoo.pyrszDistro.__init__NcCsFtj|jdj|j�dd�tjdgdd�tjddd	|jgdd�d
S)z�rc-only - not compatible with systemd

        Locales need to be added to /etc/locale.gen and generated prior
        to selection. Default to en_US.UTF-8 for simplicity.
        �
i�)�modez
locale-genF)�captureZeselectZlocale�setN)r�
write_file�
locale_gen_fn�join�localesr�default_locale)r�_Zout_fnrrr�apply_locale+szDistro.apply_locale)�pkglistcCs|j�|jd|d�dS)N�)�pkgs)�update_package_sources�package_command)rrrrr�install_packages;szDistro.install_packagesc
Cs�tj|�}tjd||�|j�}g}�xx|j�D�]j\}}d|krP|j|d�|dkrZq0|jd|}|jd�}t	|t
tf�r�tt|��j
dd�}d}	|jd�dkr�|	d	j|d
�7}	n@|	dj||jd�|jd
�|jd�d�7}	|	dj||jd�d�7}	|jd��r|	dj||d�7}	tj||	�|j|�|jd�r0dddj|d
�dg}
y*tj|
�\}}t|��rrtjd|
|�Wq0tjk
�r�tjtd|
�Yq0Xq0W|�r�tj|jt|��|S)Nz3Translated ubuntu style network settings %s into %szdns-nameservers�lo�.�,r Z	bootprotoZdhcpzconfig_{name}="dhcp")rzEconfig_{name}="{ip_address} netmask {netmask}"
mac_{name}="{hwaddr}"
Zaddress�netmaskZ	hwaddress)rZ
ip_addressr(Zhwaddrz&routes_{name}="default via {gateway}"
�gateway)rr)z"dns_servers_{name}="{dnsservers}"
)rZ
dnsservers�autoz	rc-update�addz
net.{name}�defaultz(Running %s resulted in stderr output: %sz#Running interface command %s failed)rZtranslate_networkr
�debug�keys�items�extend�network_conf_fn�get�
isinstance�list�tuple�str�replace�formatrr�_create_network_symlinkr�len�warning�ProcessExecutionError�logexcZresolve_conf_fn�convert_resolv_conf)
r�settingsZentriesZ	dev_namesZnameserversZdev�infoZnet_fnZdns_nameservers�results�cmd�_out�errrrr�_write_network?sf






zDistro._write_networkcCs&dj|d�}tj|�s"tjd|�dS)Nz/etc/init.d/net.{name})rz/etc/init.d/net.lo)r8rZis_linkZsym_link)Zinterface_nameZ	file_pathrrrr9�s
zDistro._create_network_symlinkcCsld|dg}tjd||�y(tj|�\}}t|�r@tjd||�dStjk
rftjtd|�dSXdS)Nz/etc/init.d/net.%sZrestartz8Attempting to run bring up interface %s using command %sz(Running %s resulted in stderr output: %sTz#Running interface command %s failedF)r
r-rr:r;r<rr=)rZdevice_namerBrCrDrrr�_bring_up_interface�s
zDistro._bring_up_interfacecCs�d}x|D]}|dkr
d}q
W|r�ddg}y(tj|�\}}t|�rPtjd||�Wn$tjk
rvtjtd|�dSXdd	�|jd
�D�}tj	j
||�Stj	j
||�SdS)NF�allTZlsz/etc/init.d/net.*z(Running %s resulted in stderr output: %sz#Running interface command %s failedcSsg|]}|jd�d�qS)r&�)�split)�.0�xrrr�
<listcomp>�sz/Distro._bring_up_interfaces.<locals>.<listcomp>z  )rr:r
r;r<rr=rIrr
�_bring_up_interfaces)rZdevice_namesZuse_all�drBrCrDZdevicesrrrrM�s"
zDistro._bring_up_interfacescCsrd}y|j|�}Wn.tk
r@tj|jdd�}|r8ndSYnX|sNtd�}|jd|�tj|t|�d�dS)N�create_hostname_fileTr z
hostname="%s"i�)	�_read_hostname_conf�IOErrorrZget_cfg_option_boolZ_cfgrZset_hostnamerr6)r�hostname�filename�confrOrrr�_write_hostname�s
zDistro._write_hostnamecCs|j|j�}|j|fS)N)�_read_hostname�hostname_conf_fn)rZsys_hostnamerrr�_read_system_hostname�szDistro._read_system_hostnamecCsttj|��}|j�|S)N)rrZ	load_file�parse)rSrTrrrrP�szDistro._read_hostname_confcCs:d}y|j|�}|j}Wntk
r,YnX|s6|S|S)N)rPrRrQ)rrSr,rRrTrrrrV�s

zDistro._read_hostnamecCstj||j|�d�dS)N)�tzZtz_file)rZset_etc_timezoneZ
_find_tz_file)rrZrrr�set_timezone�szDistro.set_timezonecCs�dg}|jd�|dkr(|jddg�nb|dkr4g}|rNt|t�rN|j|�n|rft|t�rf|j|�|rt|j|�tjd|�}|j|�tj|dd�dS)	NZemergez--quietZupgradez--updateZworldz%s-%sF)r)�appendr0r3r6r4rZexpand_package_listr)rZcommand�argsr!rBrrrrr#�s



zDistro.package_commandcCs|jjd|jdgtd�dS)Nzupdate-sourcesz--sync)Zfreq)rZrunr#r	)rrrrr"�s
zDistro.update_package_sources)N)N)NN)�__name__�
__module__�__qualname__Zlocale_conf_fnrr1rWZinit_cmdrrrrrr$rE�staticmethodr9rFrMrUrXrPrVr[r#r"rrrrr
s*
F

r
cCs,d}t|t�r(x|D]}|d|7}qW|S)z4Returns a settings string formatted for resolv.conf.r znameserver %s
)r3r4)r?�result�nsrrrr>s


r>)ZloggingZ	cloudinitrrrrZcloudinit.distrosrrZ"cloudinit.distros.parsers.hostnamerZcloudinit.settingsr	Z	getLoggerr^r
r
r>rrrr�<module>	s
r

Filemanager

Name Type Size Permission Actions
OpenCloudOS.cpython-36.opt-1.pyc File 542 B 0644
OpenCloudOS.cpython-36.pyc File 542 B 0644
TencentOS.cpython-36.opt-1.pyc File 540 B 0644
TencentOS.cpython-36.pyc File 540 B 0644
__init__.cpython-36.opt-1.pyc File 35.6 KB 0644
__init__.cpython-36.pyc File 35.6 KB 0644
almalinux.cpython-36.opt-1.pyc File 313 B 0644
almalinux.cpython-36.pyc File 313 B 0644
alpine.cpython-36.opt-1.pyc File 6.78 KB 0644
alpine.cpython-36.pyc File 6.78 KB 0644
amazon.cpython-36.opt-1.pyc File 450 B 0644
amazon.cpython-36.pyc File 450 B 0644
arch.cpython-36.opt-1.pyc File 7.33 KB 0644
arch.cpython-36.pyc File 7.33 KB 0644
bsd.cpython-36.opt-1.pyc File 4.87 KB 0644
bsd.cpython-36.pyc File 4.87 KB 0644
bsd_utils.cpython-36.opt-1.pyc File 1.09 KB 0644
bsd_utils.cpython-36.pyc File 1.09 KB 0644
centos.cpython-36.opt-1.pyc File 310 B 0644
centos.cpython-36.pyc File 310 B 0644
cloudlinux.cpython-36.opt-1.pyc File 314 B 0644
cloudlinux.cpython-36.pyc File 314 B 0644
cos.cpython-36.opt-1.pyc File 309 B 0644
cos.cpython-36.pyc File 309 B 0644
debian.cpython-36.opt-1.pyc File 7.52 KB 0644
debian.cpython-36.pyc File 7.52 KB 0644
dragonflybsd.cpython-36.opt-1.pyc File 361 B 0644
dragonflybsd.cpython-36.pyc File 361 B 0644
eurolinux.cpython-36.opt-1.pyc File 313 B 0644
eurolinux.cpython-36.pyc File 313 B 0644
fedora.cpython-36.opt-1.pyc File 310 B 0644
fedora.cpython-36.pyc File 310 B 0644
freebsd.cpython-36.opt-1.pyc File 6.21 KB 0644
freebsd.cpython-36.pyc File 6.21 KB 0644
gentoo.cpython-36.opt-1.pyc File 6.91 KB 0644
gentoo.cpython-36.pyc File 6.91 KB 0644
mariner.cpython-36.opt-1.pyc File 1.54 KB 0644
mariner.cpython-36.pyc File 1.54 KB 0644
miraclelinux.cpython-36.opt-1.pyc File 316 B 0644
miraclelinux.cpython-36.pyc File 316 B 0644
net_util.cpython-36.opt-1.pyc File 1.84 KB 0644
net_util.cpython-36.pyc File 1.84 KB 0644
netbsd.cpython-36.opt-1.pyc File 4.58 KB 0644
netbsd.cpython-36.pyc File 4.58 KB 0644
networking.cpython-36.opt-1.pyc File 12.21 KB 0644
networking.cpython-36.pyc File 12.21 KB 0644
openbsd.cpython-36.opt-1.pyc File 2.26 KB 0644
openbsd.cpython-36.pyc File 2.26 KB 0644
openeuler.cpython-36.opt-1.pyc File 538 B 0644
openeuler.cpython-36.pyc File 538 B 0644
openmandriva.cpython-36.opt-1.pyc File 318 B 0644
openmandriva.cpython-36.pyc File 318 B 0644
opensuse-leap.cpython-36.opt-1.pyc File 321 B 0644
opensuse-leap.cpython-36.pyc File 321 B 0644
opensuse-microos.cpython-36.opt-1.pyc File 324 B 0644
opensuse-microos.cpython-36.pyc File 324 B 0644
opensuse-tumbleweed.cpython-36.opt-1.pyc File 327 B 0644
opensuse-tumbleweed.cpython-36.pyc File 327 B 0644
opensuse.cpython-36.opt-1.pyc File 6.28 KB 0644
opensuse.cpython-36.pyc File 6.28 KB 0644
photon.cpython-36.opt-1.pyc File 4.31 KB 0644
photon.cpython-36.pyc File 4.31 KB 0644
rhel.cpython-36.opt-1.pyc File 4.82 KB 0644
rhel.cpython-36.pyc File 4.82 KB 0644
rhel_util.cpython-36.opt-1.pyc File 969 B 0644
rhel_util.cpython-36.pyc File 969 B 0644
rocky.cpython-36.opt-1.pyc File 309 B 0644
rocky.cpython-36.pyc File 309 B 0644
sle-micro.cpython-36.opt-1.pyc File 317 B 0644
sle-micro.cpython-36.pyc File 317 B 0644
sle_hpc.cpython-36.opt-1.pyc File 315 B 0644
sle_hpc.cpython-36.pyc File 315 B 0644
sles.cpython-36.opt-1.pyc File 312 B 0644
sles.cpython-36.pyc File 312 B 0644
suse.cpython-36.opt-1.pyc File 312 B 0644
suse.cpython-36.pyc File 312 B 0644
ubuntu.cpython-36.opt-1.pyc File 1.45 KB 0644
ubuntu.cpython-36.pyc File 1.45 KB 0644
ug_util.cpython-36.opt-1.pyc File 3.91 KB 0644
ug_util.cpython-36.pyc File 3.91 KB 0644
virtuozzo.cpython-36.opt-1.pyc File 313 B 0644
virtuozzo.cpython-36.pyc File 313 B 0644