make apt repo configuration optional
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 29 Feb 2016 17:04:24 +0100
changeset 72 e30b533a587c
parent 71 6b48c4f8656e
child 73 2ed939744ec0
make apt repo configuration optional
cubicweb/init.sls
--- a/cubicweb/init.sls	Thu Feb 11 14:30:48 2016 +0100
+++ b/cubicweb/init.sls	Mon Feb 29 17:04:24 2016 +0100
@@ -1,10 +1,11 @@
+{% if pillar.get('debian_pkgrepos') %}
 include:
-  - logilab.signingkey
-{% if pillar.get('debian_pkgrepos') %}
   {% for info in pillar['debian_pkgrepos'].itervalues() %}
   - {{ info['sls'] }}
   {% endfor %}
 {% elif pillar.get('extra_sources') == None %}
+include:
+  - logilab.signingkey
   - logilab.public
   - logilab.backports
   - cubicweb.dependencies
@@ -35,12 +36,16 @@
     {% elif pillar.get('extra_sources') == None %}
       - pkgrepo: logilab-public-production
       - pkgrepo: logilab-public-acceptance
-    {% else %}
-      {% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
+    {% if 'cubicweb_repo' in pillar %}
+    - fromrepo: {{pillar['cubicweb_repo']}}
+    {% endif %}
+    {% elif salt['pillar.get']('extra_sources', ()) %}
+      {% for extrasrc in pillar['extra_sources'] %}
       - pkgrepo: {{ extrasrc }}
       {% endfor %}
+    {% else %}
+       []
     {% endif %}
-    - fromrepo: {{pillar.get('cubicweb_repo', 'production')}}
 
 cw-core:
   pkg.installed:
@@ -55,7 +60,9 @@
       - cubicweb-ctl
       - cubicweb-postgresql-support
       - cubicweb-server
-    - fromrepo: {{pillar.get('cubicweb_repo', 'production')}}
+    {% if 'cubicweb_repo' in pillar %}
+    - fromrepo: {{pillar['cubicweb_repo']}}
+    {% endif %}
     {% endif %}
     - require:
       - pkg: cw-logilab-deps
@@ -73,7 +80,9 @@
       - cubicweb-keyword
       - cubicweb-localperms
       - cubicweb-tag
-    - fromrepo: {{pillar.get('cubicweb_repo', 'production')}}
+    {% if 'cubicweb_repo' in pillar %}
+    - fromrepo: {{pillar['cubicweb_repo']}}
+    {% endif %}
     - require:
       - pkg: cw-core
 {% endif %}
@@ -87,7 +96,9 @@
     {% else %}
       - cubicweb-web
       - cubicweb-twisted
-    - fromrepo: {{pillar.get('cubicweb_repo', 'production')}}
+    {% endif %}
+    {% if 'cubicweb_repo' in pillar %}
+    - fromrepo: {{pillar['cubicweb_repo']}}
     {% endif %}
     - require:
       - pkg: cw-core