[cubicweb] rename pillar extra_source in extra_sources
authorDavid Douard <david.douard@logilab.fr>
Thu, 04 Jun 2015 14:30:10 +0200
changeset 24 d3c95626e76c
parent 23 89ecb6de011e
child 25 83c1a8d26a29
[cubicweb] rename pillar extra_source in extra_sources and make it a list
cubicweb/instances.sls
--- a/cubicweb/instances.sls	Tue May 19 14:09:45 2015 +0200
+++ b/cubicweb/instances.sls	Thu Jun 04 14:30:10 2015 +0200
@@ -1,22 +1,21 @@
 include:
   - cubicweb
 
-{% if salt['pillar.get']('extra_source') %}
-{% if 'https' in  pillar['extra_source'] %}
+{% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
+{% if 'https' in  extrasrc %}
 apt-transport-https:
-    pkg:
-        - installed
+  pkg:
+    - installed
+{% break %}
 {% endif %}
+{% endfor %}
 
-cubicweb extra source: 
+{% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
+{{ extrasrc }}: 
     pkgrepo.managed:
-        - name : {{ pillar['extra_source'] }}
-        - file: /etc/apt/sources.list.d/extra_source.list
-{% if pillar['extra_source'].startswith('https') %}
-        - require:
-            - pkg : apt-transport-https
-{% endif %}
-{% endif %}
+        - name : {{ extrasrc }}
+        - file: /etc/apt/sources.list.d/extra_source_{{loop.index}}.list
+{% endfor %}
 
 {% for vhostname, vhost in pillar['cubicweb_apps'].iteritems() %}
  {% for name, config in vhost.iteritems() %}
@@ -44,9 +43,6 @@
         {% endfor %}
     - require:
       - pkg: cw-web
-{% if salt['pillar.get']('extra_source') %}
-      - pkgrepo: cubicweb extra source
-{% endif %}
 
 cw-{{vhostname}}-{{name}}-running:
   cubicweb_instance.running:
@@ -55,11 +51,11 @@
       - cubicweb_instance: cw-{{vhostname}}-{{name}}
 
 configure cw-{{vhostname}}-{{name}}:
-    ini.options_present:
-        - name: /etc/cubicweb.d/{{name}}/all-in-one.conf
-        - sections: 
-            WEB:
-                base-url: http://{{vhostname}}
+  ini.options_present:
+    - name: /etc/cubicweb.d/{{name}}/all-in-one.conf
+    - sections:
+        WEB:
+          base-url: http://{{vhostname}}
  {% endfor %}
 {% endfor %}