<?xml version="1.0" encoding="utf-8"?>

<creole>

    <files>
        <service method='apache' servicelist='gaspacho_apache'>gaspacho-apache</service>
        <file name='/etc/nginx/web.d/gaspacho.conf' source='gaspacho.nginx.conf' mkdir='True' rm='True' filelist='gaspacho_nginx' />
        <file name='/etc/apache2/sites-available/gaspacho-apache.conf' source='gaspacho.apache.conf' filelist='gaspacho_apache' />
    </files>

    <containers>
        <container name="gaspacho" id="24" group="fichier">
            <package>gaspacho</package>
            <service servicelist="gaspacho">gaspacho</service>
            <file name="/etc/gaspacho/gaspacho.conf" filelist="gaspacho" mkdir="True"/>
            <file name="/etc/gaspacho/eole.conf" filelist="gaspacho" source="eole_gaspacho.conf"/>
            <file name="/etc/default/gaspacho" filelist="gaspacho" rm="True"/>
            <service_access service='gaspacho'>
                <port>8080</port>
            </service_access>
        </container>
    </containers>

    <variables>
        <family name='services'>

            <variable name='test_activer_gaspacho' type='oui/non' description='Vérifier si l’on peut activer Gaspacho' />

            <variable name='activer_gaspacho' type="oui/non" description="Activer Gaspacho">
                <value>oui</value>
            </variable>

            <!-- Workaround when eole-reverseproxy is not installed -->
            <variable name='activer_nginx_web' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>

            <variable name='nginx_degrade_http' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>

            <!-- Workaround when eole-web is not installed -->
            <variable name='activer_apache' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>

        </family>
        <family name='gaspacho' mode='expert' icon='coffee'>
            <variable name='gaspacho_force_resolve_dns_name' type="oui/non" description="Utiliser les entrées DNS des clients plutôt que le nom fourni par l'agent">
                <value>non</value>
            </variable>
            <variable name='gaspacho_https' type='oui/non' description="Forcer l'accès à Gaspacho sur le port 80" hidden='True'>
                <value>oui</value>
            </variable>
            <variable name='gaspacho_http_path' type='string' description='Chemin d’accès de l’application Gaspacho' mode='expert'>
                <value>/gaspacho</value>
            </variable>
        </family>
    </variables>

    <constraints>
        <condition name="disabled_if_in" source="activer_gaspacho">
            <param>non</param>
            <target type="family">gaspacho</target>
            <target type="servicelist">gaspacho</target>
            <target type="servicelist">gaspacho_apache</target>
            <target type="filelist">gaspacho</target>
            <target type='filelist'>gaspacho_apache</target>
            <target type='filelist'>gaspacho_nginx</target>
        </condition>

        <condition name='frozen_if_in' source='activer_gaspacho'>
            <param>non</param>
            <target type='variable' optional="True">activer_gaspacho_agent</target>
        </condition>

        <!-- Check if service can be enabled on master only:
             - When container is enabled, check only for activer_nginx_web
             - All other cases must check activer_nginx_web and apache
        -->
        <auto name='activate_master_only_web_app' target='test_activer_gaspacho'>
            <param type='eole' name='mode_conteneur_actif'>mode_conteneur_actif</param>
            <param type='eole' name='activer_nginx_web' hidden='False'>activer_nginx_web</param>
            <param type='eole' name='activer_apache' hidden='False'>activer_apache</param>
        </auto>

        <condition name='disabled_if_in' source='test_activer_gaspacho'>
            <param>non</param>
            <target type='variable'>activer_gaspacho</target>
        </condition>

        <!-- Do not configure Nginx if Nginx is disabled -->
        <condition name='disabled_if_in' source='activer_nginx_web' fallback='True'>
            <param>non</param>
            <target type='filelist'>gaspacho_nginx</target>
        </condition>

        <!-- Do not configure Apache if we use Nginx -->
        <condition name='disabled_if_in' source='activer_nginx_web' fallback='True'>
            <param>oui</param>
            <target type='filelist'>gaspacho_apache</target>
            <target type='servicelist'>gaspacho_apache</target>
        </condition>

        <!-- Do not configure Apache if Apache is disabled -->
        <condition name='disabled_if_in' source='activer_apache' fallback='True'>
            <param>non</param>
            <target type='filelist'>gaspacho_apache</target>
            <target type='servicelist'>gaspacho_apache</target>
        </condition>

    </constraints>
    <help>
        <family name='gaspacho'>Paramétrage avancé de la configuration des postes de travail</family>
        <variable name='activer_gaspacho'>Gaspacho est une application permettant de configurer automatiquement le poste de travail de l'utilisateur selon son profil</variable>
    </help>
</creole>
<!-- vim: ts=4 sw=4 expandtab
-->
