
    dV                     4    d Z ddlZddlmc mZ d Zd Zd Zy)z0Module for detecting the existence of cloud-init    Nc                     	 t        j                  g dt         j                        j                  d      j	                  dd      } | dk(  }|S # t
        $ r1}t        j                  dj                  |             d}Y d	}~|S d	}~ww xY w)
z
    Determine whether or not cloud-init is enabled on a systemd machine.

    Args:
        None

    Returns:
        bool: True if cloud-init is enabled, False if otherwise.
    )	systemctlz
is-enabledzcloud-init-local.servicestderrzutf-8
 enabledz;Unable to get cloud-init enabled status from systemctl: {0}FN)	
subprocesscheck_outputSTDOUTdecodereplace	Exceptionloggerinfoformat)systemctl_outputunit_is_enabledexcs      N/usr/lib/python3/dist-packages/azurelinuxagent/pa/provision/cloudinitdetect.py_cloud_init_is_enabled_systemdr      s     %22 4
 ##	% &,VG_WWT25F	 	 +i7 	   QXXY\]^	 s   AA 	B	&BB	c                      	 t        j                  g dt         j                         d} | S # t        $ r1}t	        j
                  dj                  |             d} Y d}~| S d}~ww xY w)z
    Determine whether or not cloud-init is enabled on a non-systemd machine.

    Args:
        None

    Returns:
        bool: True if cloud-init is enabled, False if otherwise.
    )servicez
cloud-initstatusr   Tz9Unable to get cloud-init enabled status from service: {0}FN)r
   r   r   r   r   r   r   )r   r   s     r   _cloud_init_is_enabled_servicer       sj      !
 ##		%  	   OVVWZ[\	 s   )- 	A'&A""A'c                  z    t               xs
 t               } t        j                  dj	                  |              | S )z
    Determine whether or not cloud-init is enabled.

    Args:
        None

    Returns:
        bool: True if cloud-init is enabled, False if otherwise.
    zcloud-init is enabled: {0})r   r   r   r   r   )r   s    r   cloud_init_is_enabledr   :   s3     56Z:X:ZO
KK,33ODE    )__doc__r
   azurelinuxagent.common.loggercommonr   r   r   r    r   r   <module>r#      s     6  . .44r   