MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: machen (1008)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyc
�
d�bc@s�ddlZddlZddljjZddljjjZddljjj	Z	ddl
mZddlm
Z
defd��YZdS(i����N(t
DefaultOSUtil(tNetworkInterfaceCardt
OpenWRTOSUtilcBs�eZd�Zed�Zddd�Zd�Zed�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zdd�ZRS(cCsDtt|�j�d|_d|_tjd�|_t|_	dS(Ns/etc/waagent.conftudhcpcs^\d+:\s+(\w+):\s+(.*)$(
tsuperRt__init__tagent_conf_file_patht
dhclient_nametretcompiletip_command_outputtTruetjit_enabled(tself((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyRs
		cCstjd�dS(Ns!eject is not supported on OpenWRT(tloggertwarn(R
tchk_err((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt	eject_dvd%scCs�|j|�}|dk	r/tjd|�dS|dk	rYdd|ddd|g}ndd|ddg}tjjd�s�tjd�n|dk	r�|jd	|g�n|j	|d
dj
|��dS(s5
        Create user account with 'username'
        s%User {0} already exists, skip useraddNtuseradds-ms-ss/bin/ashs-es/homes-cterr_msgs!Failed to create user account:{0}(t
get_userentrytNoneRtinfotostpathtexiststmkdirtextendt _run_command_raising_OSUtilErrortformat(R
tusernamet
expirationtcommentt	userentrytcmd((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyR(scCs|jd|jg�S(Ntpidof(t
_get_dhcp_pidR(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytget_dhcp_pid=scCs�|r
dSi}tjddtdt�\}}|dkrZtjdj||��iSxZ|j�D]L}|jj|�}|rg|j	d�}t
||j	d��||<qgqgW|j|d	t
jd
�|j|dt
j
d�|S(
s�
        Capture NIC state (IPv4 and IPv6 addresses plus link state).

        :return: Dictionary of NIC state objects, with the NIC name as key
        :rtype: dict(str,NetworkInformationCard)
        ts
ip -o linkRtlog_cmdis.Could not fetch NIC link info; status {0}, {1}iisip -o -f inet addresssan IPv4 addresssip -o -f inet6 addresssan IPv6 address(t	shellutiltrun_get_outputtFalseRtverboseRt
splitlinesR
tmatchtgroupRt_update_nic_statetadd_ipv4tadd_ipv6(R
t	as_stringtstatetstatustoutputtentrytresulttname((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt
get_nic_state@s!#c
Cs�tj|dt�\}}|dkr+dSx�|j�D]r}|jj|�}|r8|jd�}	|	|kr�|||	|jd��q�tjdj	|	|��q8q8WdS(s�
        Update the state of NICs based on the output of a specified ip subcommand.

        :param dict(str, NetworkInterfaceCard) state: Dictionary of NIC state objects
        :param str ip_command: The ip command to run
        :param handler: A method on the NetworkInterfaceCard class
        :param str description: Description of the particular information being added to the state
        RiNiis'Interface {0} has {1} but no link state(
R(R)RR,R
R-R.RterrorR(
R
R3t
ip_commandthandlertdescriptionR4R5R6R7tinterface_name((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyR/]s	cCsdS(N((R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytis_dhcp_enabledsscCsdS(N((R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytstart_dhcp_servicevscCsdS(N((R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytstop_dhcp_serviceyscCstjddt�S(Ns/etc/init.d/network startR(R(trunR(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt
start_network|scCs6tjjd�r%tjddt�Stjd�dS(Ns/etc/init.d/sshds/etc/init.d/sshd restartRssshd service does not exists(RRRR(RBRRR(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytrestart_ssh_servicescCstjdj|j�dt�S(Ns/etc/init.d/{0} stopR(R(RBRtservice_nameR(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytstop_agent_service�scCstjdj|j�dt�S(Ns/etc/init.d/{0} startR(R(RBRRER(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytstart_agent_service�scCstjdj|j�dt�S(Ns/etc/init.d/{0} enableR(R(RBRRER(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytregister_agent_service�scCstjdj|j�dt�S(Ns/etc/init.d/{0} disableR(R(RBRRER(R
((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytunregister_agent_service�scCs]tjd|�dddj|�gdddgddgg}|j|d	td
t�dS(Ns
/etc/hostnametucitsetssystem.@system[0].hostname={0}tcommittsystems/etc/init.d/systemtreloadt	log_errortcontinue_on_error(tfileutilt
write_fileRt&_run_multiple_commands_without_raisingR*(R
thostnametcommands((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytset_hostname�s!R&cCsdS(N((R
trules_files((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pytremove_rules_files�sN(t__name__t
__module__RRRRRR%R*R9R/R?R@RARCRDRFRGRHRIRVRX(((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyRs"													(RRtazurelinuxagent.common.loggertcommonRt&azurelinuxagent.common.utils.shellutiltutilsR(t%azurelinuxagent.common.utils.fileutilRQt%azurelinuxagent.common.osutil.defaultRt(azurelinuxagent.common.utils.networkutilRR(((sI/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt<module>s