404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.137.198.37: ~ $
3

\�me"�@s�ddlZddlZddlmZmZmZmZddlmZm	Z	ddl
mZddlm
Z
ddlmZddlmZeje�ZGdd	�d	ej�Zdd
d�Zdd�Zdd�ZdS)�N)�distros�helpers�subp�util)�PackageList�net_util)�HostnameConf)�Renderer)�RendererNotFoundError)�PER_INSTANCEcs�eZdZdZdZdgZddddd�iZd	d
�Zd*dd
�Ze	d�dd�Z
ed��fdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd+d d!�Zd"d#�Zd$d%�Zd,d&d'�Zd(d)�Z�ZS)-�Distroz/etc/locale.genz/etc/netctlZ	systemctlZnetplanz/etc/netplan/50-cloud-init.yamlz# generated by cloud-init
T)Znetplan_pathZnetplan_headerZpostcmdscCs0tjj||||�tj|�|_d|_d|d<dS)NZarchZsshdZssh_svcname)rr�__init__rZRunners�_runnerZosfamily)�self�nameZcfg�paths�r�/usr/lib/python3.6/arch.pyr
 szDistro.__init__NcCsj|dk	r|dkrtjd|�tj�d|dg}tj|jdj|��tjdgdd�tjd	d
|gdd�dS)Nz/etc/locale.confzFInvalid locale_configfile %s, only supported value is /etc/locale.confz%s UTF-8��
z
locale-genF)�captureZ	localectlz
set-locale)�LOG�warningrZmake_header�
write_file�
locale_gen_fn�joinr)rZlocaleZout_fn�linesrrr�apply_locale)szDistro.apply_locale)�pkglistcCs|j�|jd|d�dS)Nr)�pkgs)�update_package_sources�package_command)rrrrr�install_packages<szDistro.install_packages)�returncs8y
t�j�Stk
r2}zt|�WYdd}~XnXdS)N)�super�
_get_rendererr
�NotImplementedError)r�e)�	__class__rrr%@s
zDistro._get_renderercCs.tj|�}tjd||�t||j|j|jd�S)Nz3Translated ubuntu style network settings %s into %s)�resolv_conf�conf_dir�enable_func)rZtranslate_networkr�debug�_render_networkZresolve_conf_fn�network_conf_dir�_enable_interface)r�settings�entriesrrr�_write_networkGs
zDistro._write_networkcCs\dd|g}y(tj|�\}}t|�r0tjd||�Wn$tjk
rVtjtd|�YnXdS)N�netctlZreenablez(Running %s resulted in stderr output: %sz#Running interface command %s failed)r�lenrr�ProcessExecutionErrorr�logexc)r�device_name�cmd�_out�errrrrr/Us
zDistro._enable_interfacecCsjdd|g}tjd||�y(tj|�\}}t|�r>tjd||�dStjk
rdtjtd|�dSXdS)Nr3Zrestartz8Attempting to run bring up interface %s using command %sz(Running %s resulted in stderr output: %sTz#Running interface command %s failedF)rr,rr4rr5rr6)rr7r8r9r:rrr�_bring_up_interface`s

zDistro._bring_up_interfacecCsrd}y|j|�}Wn.tk
r@tj|jdd�}|r8ndSYnX|sNtd�}|j|�tj|t|�ddd�dS)N�create_hostname_fileTr�wi�)Zomode�mode)	�_read_hostname_conf�IOErrorrZget_cfg_option_boolZ_cfgrZset_hostnamer�str)r�hostname�filename�confr<rrr�_write_hostnamers

zDistro._write_hostnamecCs|j|j�}|j|fS)N)�_read_hostnameZhostname_conf_fn)rZsys_hostnamerrr�_read_system_hostname�szDistro._read_system_hostnamecCsttj|��}|j�|S)N)rrZ	load_file�parse)rrCrDrrrr?�szDistro._read_hostname_confcCs:d}y|j|�}|j}Wntk
r,YnX|s6|S|S)N)r?rBr@)rrC�defaultrBrDrrrrF�s

zDistro._read_hostnamecCsLtjd|�ytjddd|g�Wn$tjk
rFtjtd|�YnXdS)Nz2Non-persistently setting the system hostname to %sZhostnamectlz--transientzset-hostnamez;Failed to non-persistently adjust the system hostname to %s)rr,rr5rr6)rrBrrr�_apply_hostname�szDistro._apply_hostnamecCstj||j|�d�dS)N)�tzZtz_file)rZset_etc_timezoneZ
_find_tz_file)rrKrrr�set_timezone�szDistro.set_timezonecCs�|dkrg}ddddg}|r2t|t�r2|j|�n|rJt|t�rJ|j|�|dkrVd}|rd|j|�tjd|�}|j|�tj|dd	�dS)
NZpacmanz-Syz--quietz--noconfirmZupgradez-uz%s-%sF)r)�
isinstancerA�append�list�extendrZexpand_package_listr)rZcommand�argsrr8rrrrr!�s


zDistro.package_commandcCs|jjd|jdgtd�dS)Nzupdate-sourcesz-y)Zfreq)rZrunr!r)rrrrr �szDistro.update_package_sources)N)N)NN)�__name__�
__module__�__qualname__rr.Zinit_cmdZrenderer_configsr
rrr"r	r%r2r/r;rErGr?rFrJrLr!r �
__classcell__rr)r(rrs,
	




r�/�
etc/netctl�etc/resolv.confc	Cs�g}g}tj||�}tj||�}x�|j�D]�\}}|dkr<q*|j|�tjj||�}	d||jd�d|jd�|jd�f|jd�|jdg�d	�}
tj	|	t
|
��|r�|jd
�r�||�d|kr*|j|d�q*W|r�tj	|t|��|S)znRender the translate_network format into netctl files in target.
    Paths will be rendered under target.
    �loZethernetZ	bootprotoz%s/%sZaddressZnetmaskZgatewayzdns-nameservers)Z
ConnectionZ	InterfaceZIPZAddressZGatewayZDNS�auto)
rZtarget_path�itemsrN�os�pathr�getrr�convert_netctlrP�convert_resolv_conf)r1�targetr*r)r+ZdevsZnameserversZdev�infoZnet_fnZnet_cfgrrrr-�s.
r-cCsrg}xbt|�D]V}||}|dkr(d}n*t|ttf�rRddjdd�|D��d}|jd||f�qWdj|�S)	z�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.Nr�(� css|]}d|VqdS)z'%s'Nr)�.0�vrrr�	<genexpr>�sz!convert_netctl.<locals>.<genexpr>�)z%s=%s
)�sortedrM�tuplerOrrN)r0�result�key�valrrrr_�sr_cCs,d}t|t�r(x|D]}|d|}qW|S)z4Returns a settings string formatted for resolv.conf.rznameserver %s
)rMrO)r0rk�nsrrrr`s


r`)rVrWrXN)Zloggingr\Z	cloudinitrrrrZcloudinit.distrosrrZ"cloudinit.distros.parsers.hostnamerZcloudinit.net.rendererr	Zcloudinit.net.renderersr
Zcloudinit.settingsrZ	getLoggerrRrrr-r_r`rrrr�<module>s 
7
$

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