§
    áˆFj¯	  ã                   óV   — d Z ddlZddlZ ej        e¦  «        ZdZd„ Zd„ Z	d„ Z
d„ ZdS )zÐ
Support for Apache

Please note: The functions in here are SUSE-specific. Placing them in this
separate file will allow them to load only on SUSE systems, while still
loading under the ``apache`` namespace.
é    NÚapachec                  ó~   — t           j        j                             d¦  «        rt          d         dk    rt
          S dS )z6
    Only load the module if apache is installed.
    Ú	apachectlÚ	os_familyÚSuse)Fz9apache execution module not loaded: apache not installed.)ÚsaltÚutilsÚpathÚwhichÚ
__grains__Ú__virtualname__© ó    úE/opt/saltstack/salt/extras-3.11/saltext/apache/modules/suse_apache.pyÚ__virtual__r      s9   € õ „z„×Ò˜[Ñ)Ô)ð ­j¸Ô.EÈÒ.OÐ.OÝÐØOÐOr   c                 ó  — |                       d¦  «        s|                       d¦  «        r| dd…         }n| }d}	 t          d         |d¬¦  «                             d	¦  «        }n# t          $ r}|cY d}~S d}~ww xY w||v S )
a  
    Checks to see if the specific apache mod is enabled.

    This will only be functional on operating systems that support
    `a2enmod -l` to list the enabled mods.

    CLI Example:

    .. code-block:: bash

        salt '*' apache.check_mod_enabled status
    z.loadz.confNéûÿÿÿz
a2enmod -lzcmd.runF©Úpython_shellú )ÚendswithÚ__salt__ÚsplitÚ	Exception)ÚmodÚmod_nameÚcmdÚactive_modsÚes        r   Úcheck_mod_enabledr       s«   € ð ‡|‚|�GÑÔð  §¢¨WÑ 5Ô 5ð Ø�s˜�s”8ˆˆàˆà
€CðÝ˜yÔ)¨#¸EÐBÑBÔB×HÒHÈÑMÔMˆˆøÝð ð ð Øˆˆˆˆˆˆøøøøðøøøð �{Ð"Ð"s   »*A& Á&
A<Á0A7Á1A<Á7A<c                 óÔ   — i }d| g}	 t          d         |d¬¦  «        }n# t          $ r}|cY d}~S d}~ww xY wd|d<   | |d<   |d	k    r
d
| › d�|d<   n|dk    r
d
| › d�|d<   n||d<   |S )z‚
    Runs a2enmod for the given mod.

    CLI Example:

    .. code-block:: bash

        salt '*' apache.a2enmod vhost_alias
    Úa2enmodúcmd.retcodeFr   NzApache2 Enable ModÚNameÚModé   úMod ú
 Not foundÚStatusr   z enabled©r   r   ©r   ÚretÚcommandÚstatusr   s        r   r"   r"   6   s¿   € ð €CØ˜#Ð€GðÝ˜-Ô(¨¸uÐEÑEÔEˆˆøÝð ð ð Øˆˆˆˆˆˆøøøøðøøøð '€Cˆ�KØ€Cˆ�Jà�‚{€{Ø.˜sÐ.Ð.Ð.ˆˆH‰ˆØ	�1ŠˆØ,˜sÐ,Ð,Ð,ˆˆH‰ˆàˆˆH‰à€Jó   ˆ   
6ª1«6±6c                 óÔ   — i }d| g}	 t          d         |d¬¦  «        }n# t          $ r}|cY d}~S d}~ww xY wd|d<   | |d<   |d	k    r
d
| › d�|d<   n|dk    r
d
| › d�|d<   n||d<   |S )z„
    Runs a2dismod for the given mod.

    CLI Example:

    .. code-block:: bash

        salt '*' apache.a2dismod vhost_alias
    Úa2dismodr#   Fr   NzApache2 Disable Modr$   r%   é   r'   r(   r)   r   z	 disabledr*   r+   s        r   r1   r1   U   s¿   € ð €CØ˜3Ð€GðÝ˜-Ô(¨¸uÐEÑEÔEˆˆøÝð ð ð Øˆˆˆˆˆˆøøøøðøøøð (€Cˆ�KØ€Cˆ�Jà�‚}€}Ø.˜sÐ.Ð.Ð.ˆˆH‰ˆØ	�1ŠˆØ-˜sÐ-Ð-Ð-ˆˆH‰ˆàˆˆH‰à€Jr/   )Ú__doc__ÚloggingÚsalt.utils.pathr   Ú	getLoggerÚ__name__Úlogr   r   r    r"   r1   r   r   r   ú<module>r9      s†   ððð ð €€€à Ð Ð Ð à€gÔ˜Ñ!Ô!€à€ðPð Pð Pð#ð #ð #ð6ð ð ð>ð ð ð ð r   