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: sonne (1011)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python2.7/site-packages/azurelinuxagent/ga/env.pyo
�
d�bc@s�ddlZddlZddlZddlZddljjZddljjZddl	m
Z
ddlmZm
Z
ddlmZddlmZddlmZddlmZddlmZdd	lmZmZdd
lmZejdej�ejdej�ejd
ej�gZdZ d�Z!defd��YZ"defd��YZ#defd��YZ$defd��YZ%defd��YZ&defd��YZ'defd��YZ(dS(i����N(tget_dhcp_handler(tadd_periodictWALAEventOperation(tustr(tThreadHandlerInterface(t
get_osutil(tget_protocol_util(t
StateArchiver(t
AGENT_NAMEtCURRENT_VERSION(tPeriodicOperations^(.*)\.(\d+)\.(agentsManifest)$s^(.*)\.(\d+)\.(manifest\.xml)$s^(.*)\.(\d+)\.(xml)$i2cCst�S(N(t
EnvHandler(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pytget_env_handler/stRemovePersistentNetworkRulescBseZd�Zd�ZRS(cCs)tt|�jtj��||_dS(N(tsuperR
t__init__tconft&get_remove_persistent_net_rules_periodtosutil(tselfR((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR4scCs|jj�dS(N(Rtremove_rules_files(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyt
_operation8s(t__name__t
__module__RR(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR
3s	tMonitorDhcpClientRestartcBs#eZd�Zd�Zd�ZRS(cCsTtt|�jtj��||_t�|_|jj�t	|_
g|_dS(N(RRRRt&get_monitor_dhcp_client_restart_periodRRtdhcp_handlertconf_routestTruetdhcp_warning_enabledtdhcp_id_list(RR((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR=s	
	cs�t�j�dkr(�j��_dSt�fd��jD��rKdS�j�}t|�dkr�|�jkr�tjd��jj�|�_ndS(Nic3s!|]}�jj|�VqdS(N(Rtcheck_pid_alive(t.0tpid(R(s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pys	<genexpr>JssBEnvMonitor: Detected dhcp client restart. Restoring routing table.(tlenRt_get_dhcp_client_pidtalltloggertinfoRR(Rtnew_pid((Rs:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyREs!

cCs�g}yDt|jj��}t|�dkrI|jrItjd�nWn5tk
r�}|jr�tjdt	|��q�nXt|�dk|_|S(NisDhcp client is not running.s-Failed to get the PID of the DHCP client: {0}(
tsortedRtget_dhcp_pidR"RR%twarnt	ExceptionterrorR(RR!t	exception((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR#Ss	(RRRRR#(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR<s		tCleanupGoalStateHistorycBseZd�Zd�ZRS(cCs5tt|�jtj��ttj��|_dS(N(RR.RRt%get_goal_state_history_cleanup_periodRtget_lib_dirtarchiver(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRgscCs|jj�|jj�dS(sY
        Purge history and create a .zip of the history that has been preserved.
        N(R1tpurgetarchive(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRks
(RRRR(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR.fs	tEnableFirewallcBseZd�Zd�ZRS(cCs;tt|�jtj��||_||_t|_dS(N(	RR4RRtget_enable_firewall_periodt_osutilt	_protocoltFalset _try_remove_legacy_firewall_rule(RRtprotocol((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRts		cCs�|js1|jjd|jj��t|_n|jjd|jj�dtj��}t	t
jtdt
dtjd|dt�dS(Ntdst_iptuidtversiontopt
is_successt	log_event(R9R6tremove_legacy_firewall_ruleR7tget_endpointRtenable_firewalltostgetuidRR%t
EVERY_HOURRR	RtFirewallR8(Rtsuccess((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRzs	*	(RRRR(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR4ss	tSetRootDeviceScsiTimeoutcBseZd�Zd�ZRS(cCs)tt|�jtj��||_dS(N(RRIRRt#get_root_device_scsi_timeout_periodR6(RR((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR�scCs|jjtj��dS(N(R6tset_scsi_disks_timeoutRtget_root_device_scsi_timeout(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR�s(RRRR(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRI�s	tMonitorHostNameChangescBseZd�Zd�ZRS(cCs;tt|�jtj��||_|jj�|_dS(N(RRMRRtget_monitor_hostname_periodR6tget_hostname_recordt	_hostname(RR((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR�s	cCsatj�}||jkr]tjd|j|�|jj|�|jj|�||_ndS(Ns0EnvMonitor: Detected hostname change: {0} -> {1}(tsockettgethostnameRPR%R&R6tset_hostnametpublish_hostname(Rt
curr_hostname((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR�s	(RRRR(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRM�s	RcBsYeZdZdZed��Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	s�
    Monitor changes to dhcp and hostname.
    If dhcp client process re-start has occurred, reset routes, dhcp with fabric.

    Monitor scsi disk.
    If new scsi disk found, set timeout
    RcCstjS(N(Rt_THREAD_NAME(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pytget_thread_name�scCst|_d|_d|_dS(N(RtstoppedtNonethostnamet
env_thread(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR�s		cCsG|js#tjd�|j�nt|_tjd�|j�dS(Ns"Stop existing env monitor service.sStarting env monitor service.(RXR%R&tstopR8tstart(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pytrun�s	

	
cCs
|jj�S(N(R[tis_alive(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR_�scCsOtjd|j�|_|jjt�|jj|j��|jj�dS(Nttarget(	t	threadingtThreadtdaemonR[t	setDaemonRtsetNameRWR](R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR]�scCsOyt�}|j�}t�}t|�t|�t�g}tj�rd|jt	||��ntj
�dk	r�|jt|��ntj
�r�|jt|��nxm|jszOyx|D]}|j�q�WWn)tk
r}tjdt|��nXWdtj|�Xq�WWn)tk
rJ}tjdt|��nXdS(Ns[An error occurred in the environment thread main loop; will skip the current iteration.
{0}sFAn error occurred in the environment thread; will exit the thread.
{0}(Rtget_protocolRR
RR.RRCtappendR4RLRYRItget_monitor_hostnameRMRXR^R+R%R,RR
tsleep_until_next_operation(Rt
protocol_utilR:Rtperiodic_operationsR>te((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyRc�s.				
cCs,t|_|jdk	r(|jj�ndS(sO
        Stop server communication and join the thread to main thread.
        N(RRXR[RYtjoin(R((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR\�s	(RRt__doc__RVtstaticmethodRWRR^R_R]RcR\(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyR�s						 ()treRDRQRatazurelinuxagent.common.conftcommonRtazurelinuxagent.common.loggerR%tazurelinuxagent.common.dhcpRtazurelinuxagent.common.eventRRtazurelinuxagent.common.futureRt!azurelinuxagent.common.interfacesRtazurelinuxagent.common.osutilRt$azurelinuxagent.common.protocol.utilRt$azurelinuxagent.common.utils.archiveRtazurelinuxagent.common.versionRR	t%azurelinuxagent.ga.periodic_operationR
tcompilet
IGNORECASEtCACHE_PATTERNStMAXIMUM_CACHED_FILESRR
RR.R4RIRMR(((s:/usr/lib/python2.7/site-packages/azurelinuxagent/ga/env.pyt<module>s4		*