§
    áˆFjÃ  ã                   ó.   — d Z ddlZddlZddlZd„ Zd„ ZdS )aO
  
Apache state

.. versionadded:: 2014.7.0

Allows for inputting a yaml dictionary into a file for apache configuration
files.

The variable ``this`` is special and signifies what should be included with
the above word between angle brackets (<>).

.. code-block:: yaml

    /etc/httpd/conf.d/website.com.conf:
      apache.configfile:
        - config:
          - VirtualHost:
              this: '*:80'
              ServerName:
                - website.com
              ServerAlias:
                - www.website.com
                - dev.website.com
              ErrorLog: logs/website.com-error_log
              CustomLog: logs/website.com-access_log combined
              DocumentRoot: /var/www/vhosts/website.com
              Directory:
                this: /var/www/vhosts/website.com
                Order: Deny,Allow
                Deny from: all
                Allow from:
                  - 127.0.0.1
                  - 192.168.100.0/24
                Options:
                  - Indexes
                  - FollowSymlinks
                AllowOverride: All

.. versionchanged:: 2018.3.0

Allows having the same section container multiple times (e.g. <Directory /path/to/dir>).

YAML structure stays the same only replace dictionary with a list.

When a section container does not have mandatory attribute, such as <Else>,
it still needs keyword ``this`` with empty string (or "" if nicer output is required - without space).

.. code-block:: yaml

    /etc/httpd/conf.d/website.com.conf:
      apache.configfile:
        - config:
          - VirtualHost:
              - this: '*:80'
              - ServerName:
                - website.com
              - DocumentRoot: /var/www/vhosts/website.com
              - Directory:
                  this: /var/www/vhosts/website.com
                  Order: Deny,Allow
                  Deny from: all
                  Allow from:
                    - 127.0.0.1
                    - 192.168.100.0/24
                  Options:
                    - Indexes
                    - FollowSymlinks
                  AllowOverride: All
              - Directory:
                - this: /var/www/vhosts/website.com/private
                - Order: Deny,Allow
                - Deny from: all
                - Allow from:
                  - 127.0.0.1
                  - 192.168.100.0/24
                - If:
                    this: some condition
                    do: something
                - Else:
                    this:
                    do: something else
                - Else:
                    this: ""
                    do: another thing
é    Nc                  ó   — dt           v rdS dS )Núapache.configT)Fz!apache module could not be loaded)Ú__salt__© ó    ú?/opt/saltstack/salt/extras-3.11/saltext/apache/states/apache.pyÚ__virtual__r	   ]   s   € Ø�(Ð"Ð"ØˆtØ7Ð7r   c                 óT  — | i d ddœ}t          d         | |d¬¦  «        }d}t          j                             | ¦  «        rrt          j        j                             | ¦  «        5 }t          j        j         	                    | 
                    ¦   «         ¦  «        }d d d ¦  «         n# 1 swxY w Y   |                     ¦   «         |                     ¦   «         k    rd|d<   d|d	<   |S t          d
         rd|d	<   ||dœ|d<   d |d<   |S 	 t          j        j                             | d¦  «        5 }t          t          j        j                             |¦  «        |¬¦  «         d d d ¦  «         n# 1 swxY w Y   ||dœ|d<   d|d<   d|d	<   n# t          $ r d|d<   d|d	<   Y nw xY w|S )NÚ )ÚnameÚchangesÚresultÚcommentr   F)ÚeditTr   zConfiguration is up to date.r   ÚtestzConfiguration will update.)ÚoldÚnewr   Úw)Úfilez#Successfully created configuration.z&Failed to create apache configuration.)r   ÚosÚpathÚexistsÚsaltÚutilsÚfilesÚfopenÚstringutilsÚ
to_unicodeÚreadÚstripÚ__opts__ÚprintÚto_strÚ	Exception)r   ÚconfigÚretÚconfigsÚcurrent_configsÚconfig_files         r   Ú
configfiler*   c   s^  € Ø B°$À2Ð
FÐ
F€Cå�Ô'¨¨f¸5ÐAÑAÔA€GØ€OÝ	„w‡~‚~�dÑÔð TÝŒZÔ×#Ò# DÑ)Ô)ð 	T¨[Ý"œjÔ4×?Ò?À×@PÒ@PÑ@RÔ@RÑSÔSˆOð	Tð 	Tð 	Tñ 	Tô 	Tð 	Tð 	Tð 	Tð 	Tð 	Tð 	Tøøøð 	Tð 	Tð 	Tð 	Tð ‡}‚}�„˜/×/Ò/Ñ1Ô1Ò1Ð1ØˆˆH‰Ø7ˆˆI‰Øˆ
Ý�Ôð Ø5ˆˆI‰Ø!0¸ÐAÐAˆˆI‰ØˆˆH‰Øˆ
ðBÝŒZÔ×#Ò# D¨#Ñ.Ô.ð 	L°+Ý•$”*Ô(×/Ò/°Ñ8Ô8¸{ÐKÑKÔKÐKð	Lð 	Lð 	Lñ 	Lô 	Lð 	Lð 	Lð 	Lð 	Lð 	Lð 	Løøøð 	Lð 	Lð 	Lð 	Là!0¸ÐAÐAˆˆI‰ØˆˆH‰Ø>ˆˆI‰ˆøÝð Bð Bð BØˆˆH‰ØAˆˆI‰ˆˆðBøøøð €JsH   Á%7B(Â(B,Â/B,Ä%F Ä04E0Å$F Å0E4Å4F Å7E4Å8F ÆF%Æ$F%)Ú__doc__r   Úsalt.utils.filesr   Úsalt.utils.stringutilsr	   r*   r   r   r   ú<module>r.      s]   ððTð Tðl 
€	€	€	à Ð Ð Ð Ø Ð Ð Ð ð8ð 8ð 8ðð ð ð ð r   