[cubicweb/instance] add logic to extra_sources for single repo logic
authorArthur Lutz <arthur.lutz@logilab.fr>
Tue, 21 Jul 2015 16:59:03 +0200
changeset 51 0e92434f85bf
parent 50 0ad07261a1dc
child 52 feed6387c165
[cubicweb/instance] add logic to extra_sources for single repo logic wip in https://www.cubicweb.org/ticket/5714468
cubicweb/init.sls
cubicweb/instances.sls
pillar.example
--- a/cubicweb/init.sls	Tue Jul 21 16:57:56 2015 +0200
+++ b/cubicweb/init.sls	Tue Jul 21 16:59:03 2015 +0200
@@ -1,13 +1,23 @@
+{% if pillar.get('debian_pkgrepos') %}
 include:
-  {% if pillar.get('debian_pkgrepos') %}
   {% for info in pillar['debian_pkgrepos'].itervalues() %}
   - {{ info['sls'] }}
   {% endfor %}
-  {% else %}
+{% elif pillar.get('extra_sources') == None %}
+include:
   - logilab.public
   - logilab.backports
   - cubicweb.dependencies
-  {% endif %}
+{% endif %}
+
+{% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
+{{ extrasrc }}:
+    pkgrepo.managed:
+        - name : {{ extrasrc }}
+        - file: /etc/apt/sources.list.d/extra_source_{{loop.index}}.list
+{% endfor %}
+
+
 
 cw-logilab-deps:
   pkg.installed:
@@ -22,9 +32,13 @@
     {% for  pkgrepo in pillar['debian_pkgrepos'].iterkeys() %}
       - pkgrepo: {{ pkgrepo }}
     {% endfor %}
-    {% else %}
+    {% elif pillar.get('extra_sources') == None %}
       - pkgrepo: logilab-public-production
       - pkgrepo: logilab-public-acceptance
+    {% else %}
+      {% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
+      - pkgrepo: {{ extrasrc }}
+      {% endfor %}
     {% endif %}
     - fromrepo: {{pillar.get('cubicweb_repo', 'production')}}
 
--- a/cubicweb/instances.sls	Tue Jul 21 16:57:56 2015 +0200
+++ b/cubicweb/instances.sls	Tue Jul 21 16:59:03 2015 +0200
@@ -10,13 +10,6 @@
 {% endif %}
 {% endfor %}
 
-{% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
-{{ extrasrc }}:
-    pkgrepo.managed:
-        - 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() %}
 
--- a/pillar.example	Tue Jul 21 16:57:56 2015 +0200
+++ b/pillar.example	Tue Jul 21 16:59:03 2015 +0200
@@ -26,13 +26,17 @@
 ## 'postgresql_version' option is ignored
 # postgresql_version: 9.4
 
-## you can add extra repository sources
+## You can add extra repository sources
+## when extra_sources is defined and debian_pkgrepos is undefined the "all dependencies are 
+## availble in that extra source" scenario is used, no public cubicweb debian repository 
+## will be configured. Changes pending from https://www.cubicweb.org/ticket/5714468
+
 #extra_sources:
 #  - deb https://user:password@domain.com/path/dists/ wheezy/
-## you can specify your own repository sources  instead of logilab default
-debian_pkgrepos:
-  pkgrepository_name: # cf. logilab-public-production
-    sls: pkgrepository # cf. logilab.public
+## you can specify your own repository sources from .sls definitions instead of logilab default
+#debian_pkgrepos:
+#  pkgrepository_name: # cf. logilab-public-production (id in the state file)
+#    sls: pkgrepository # cf. logilab.public (id in of the .sls file, eg. logilab/publis.sls)
 
 ## Declare your cubicweb applications there
 cubicweb_apps: