403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.6/site-packages/cloudinit/distros/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/distros/__pycache__/gentoo.cpython-36.opt-1.pyc
3

��bJ#�@sxddlmZmZddlmZddlmZmZddlmZddl	m
Z
ddlmZej
e�ZGdd�dej�Zd	d
�ZdS)�)�distros�helpers)�log)�subp�util)�net_util)�HostnameConf)�PER_INSTANCEc@s�eZdZdZdZdZdZdgZdZddgZ	d	d
�Z
d&dd
�Zdd�Zdd�Z
edd��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_localecCs|j�|jd|d�dS)N�)�pkgs)�update_package_sources�package_command)r�pkglistrrr�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�.�,rZ	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CsXd}y|j|�}Wntk
r&YnX|s4td�}|jd|�tj|t|�d�dS)Nrz
hostname="%s"i�)�_read_hostname_conf�IOErrorrZset_hostnamerrr6)r�hostname�filename�confrrr�_write_hostname�szDistro._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)rRrSrrrrO�szDistro._read_hostname_confcCs:d}y|j|�}|j}Wntk
r,YnX|s6|S|S)N)rOrQrP)rrRr,rQrSrrrrU�s

zDistro._read_hostnamecCstj||j|�d�dS)N)�tzZtz_file)rZset_etc_timezoneZ
_find_tz_file)rrYrrr�set_timezone�szDistro.set_timezonecCs�|dkrg}td�}|jd�|r8t|t�r8|j|�n|rPt|t�rP|j|�|r^|j|�tjd|�}|j|�tj|dd�dS)NZemergez--quietz%s-%sF)r)r4�appendr3r6r0rZexpand_package_listr)rZcommand�argsr rBr#rrrr"�s



zDistro.package_commandcCs|jjd|jddgtd�dS)Nzupdate-sourcesz-uZworld)Zfreq)rZrunr"r	)rrrrr!�s
zDistro.update_package_sources)N)N)NN)�__name__�
__module__�__qualname__Zlocale_conf_fnrr1rVZinit_cmdrrrrr$rE�staticmethodr9rFrMrTrWrOrUrZr"r!rrrrr
s*
F

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


r>N)Z	cloudinitrrrZloggingrrZcloudinit.distrosrZ"cloudinit.distros.parsers.hostnamerZcloudinit.settingsr	Z	getLoggerr]r
r
r>rrrr�<module>	s
i

Youez - 2016 - github.com/yon3zu
LinuXploit