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/redhat.pyc
�
d�bc@smddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
jjZddl
jjZddlmZmZddlmZmZddljjjZddljjjZddljjjZddlmZddlmZdefd��YZ de fd	��YZ!d
e!fd��YZ"dS(i����N(tustrt
bytebuffer(tOSUtilErrort
CryptError(t	CryptUtil(t
DefaultOSUtiltRedhat6xOSUtilcBsteZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(cCs tt|�j�t|_dS(N(tsuperRt__init__tTruetjit_enabled(tself((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR*scCstjddt�S(Ns/sbin/service networking starttchk_err(t	shellutiltruntFalse(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyt
start_network.scCstjddt�S(Ns/sbin/service sshd condrestartR(R
RR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytrestart_ssh_service1scCstjdj|j�dt�S(Ns/sbin/service {0} stopR(R
Rtformattservice_nameR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytstop_agent_service4scCstjdj|j�dt�S(Ns/sbin/service {0} startR(R
RRRR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytstart_agent_service7scCstjdj|j�dt�S(Nschkconfig --add {0}R(R
RRRR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytregister_agent_service:scCstjdj|j�dt�S(Nschkconfig --del {0}R(R
RRRR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytunregister_agent_service=scCsptj|�}y%ttj��}|j|�}Wn%tk
r[}tt|���nXtj	||�dS(N(
tfileutilt	read_fileRtconftget_openssl_cmdtasn1_to_sshRRRtappend_file(Rt
input_filetoutput_filetpubkeyt	cryptutiltssh_rsa_pubkeyte((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytopenssl_to_openssh@scCs|jddg�S(Ntpidoftdhclient(t
_get_dhcp_pid(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytget_dhcp_pidJscCs9tjdddj|��|jd|gdt�dS(s,
        Set /etc/sysconfig/network
        s/etc/sysconfig/networktHOSTNAMEsHOSTNAME={0}thostnamet	log_errorN(Rtupdate_conf_fileRt_run_command_without_raisingR(RR*((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytset_hostnameMs	cCs;|j�}dj|�}tj|ddj|��dS(Ns(/etc/sysconfig/network-scripts/ifcfg-{0}t
DHCP_HOSTNAMEsDHCP_HOSTNAME={0}(tget_if_nameRRR,(RR*tifnametfilepath((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytset_dhcp_hostnameVs
	cCs
|jd�S(Ns#/var/lib/dhclient/dhclient-*.leases(tget_endpoint_from_leases_path(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pytget_dhcp_lease_endpoint]s(t__name__t
__module__RRRRRRRR$R(R.R3R5(((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR(s								
				tRedhatOSUtilcBsVeZd�Zed��Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(cCs&tt|�j�|j�|_dS(N(RR8Rtget_service_nameR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyRbscCsdS(Ns/usr/lib/systemd/system((((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyt"get_systemd_unit_file_install_pathfscCssdd|dg}ytj|dt�WnCtjk
rntjdjdj|���tj	||�nXdS(s�
        Unlike redhat 6.x, redhat 7.x will set hostname via hostnamectl
        Due to a bug in systemd in Centos-7.0, if this call fails, fallback
        to hostname.
        thostnamectlsset-hostnames--staticR+s![{0}] failed, attempting fallbackt N(
R
trun_commandRtCommandErrortloggertwarnRtjoinRR.(RR*thostnamectl_cmd((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR.jscCs'tjd�tt|�j|�dS(sI
        Restart NetworkManager first before publishing hostname
        sservice NetworkManager restartN(R
RRR8tpublish_hostname(RR*((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyRCxs
cCstjdj|j�dt�S(Nssystemctl enable {0}R(R
RRRR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyRscCstjdj|j�dt�S(Nssystemctl disable {0}R(R
RRRR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR�scCstj|||�dS(N(RR$(RRR((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR$�scCs1|jd�}|dkr-|jd�}n|S(Ns"/var/lib/dhclient/dhclient-*.leases(/var/lib/NetworkManager/dhclient-*.lease(R4tNone(Rtendpoint((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR5�s(R6R7RtstaticmethodR:R.RCRRR$R5(((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR8as						tRedhatOSModernUtilcBs eZd�Zddd�ZRS(cCstt|�j�dS(N(RRGR(R((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyR�siicCs�|d}x�td|�D]�}tjdj|��}|dkrHdStjdj||��||kr�tjdj|��tj|�qtjd�qWdS(s�
        Restart an interface by bouncing the link. systemd-networkd observes
        this event, and forces a renew of DHCP.
        is*ip link set {0} down && ip link set {0} upiNs&failed to restart {0}: return code {1}sretrying in {0} secondssexceeded restart retries(	trangeR
RRR?R@tinfottimetsleep(RR1tretriestwaittretry_limittattempttreturn_code((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyt
restart_if�s
(R6R7RRQ(((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyRG�s	(#tostretpwdtshutiltsockettarraytstructtfcntlRJtbase64tazurelinuxagent.common.conftcommonRtazurelinuxagent.common.loggerR?tazurelinuxagent.common.futureRRt azurelinuxagent.common.exceptionRRt%azurelinuxagent.common.utils.fileutiltutilsRt&azurelinuxagent.common.utils.shellutilR
t%azurelinuxagent.common.utils.textutilttextutilt&azurelinuxagent.common.utils.cryptutilRt%azurelinuxagent.common.osutil.defaultRRR8RG(((sH/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/redhat.pyt<module>s*92