Merge "Fix for Keytsone v3"
diff --git a/opencontrail/collector.sls b/opencontrail/collector.sls
index 4439d3c..5e49aaa 100644
--- a/opencontrail/collector.sls
+++ b/opencontrail/collector.sls
@@ -73,29 +73,27 @@
   - makedirs: True
   - require:
     - pkg: opencontrail_collector_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_collector_services
-{%- endif %}
 
 /etc/contrail/supervisord_analytics.conf:
   file.managed:
   - source: salt://opencontrail/files/{{ collector.version }}/collector/supervisord_analytics.conf
   - require:
     - pkg: opencontrail_collector_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_collector_services
-{%- endif %}
 
 {% endif %}
 
-{%- if not grains.get('noservices', False) %}
 
 opencontrail_collector_services:
   service.running:
   - enable: true
   - names: {{ collector.services }}
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch:
     - file: /etc/contrail/contrail-analytics-api.conf
     - file: /etc/contrail/contrail-query-engine.conf
@@ -106,8 +104,6 @@
     - file: /etc/contrail/contrail-analytics-nodemgr.conf
     - file: /etc/contrail/contrail-alarm-gen.conf
 
-{%- endif %}
-
 {%- if grains.get('virtual_subtype', None) == "Docker" %}
 
 opencontrail_collector_entrypoint:
diff --git a/opencontrail/compute.sls b/opencontrail/compute.sls
index 8c922c2..8729b02 100644
--- a/opencontrail/compute.sls
+++ b/opencontrail/compute.sls
@@ -21,10 +21,8 @@
     - value: 8085,9090
     - require:
       - pkg: opencontrail_compute_packages
-    {%- if not grains.get('noservices', False)%}
     - require_in:
       - service: opencontrail_compute_services
-    {%- endif %}
 
 {%- endif %}
 
@@ -34,10 +32,8 @@
   - template: jinja
   - require:
     - pkg: opencontrail_compute_packages
-  {%- if not grains.get('noservices', False)%}
   - watch_in:
     - service: opencontrail_compute_services
-  {%- endif %}
 
 /etc/contrail/vrouter_nodemgr_param:
   file.managed:
@@ -59,10 +55,8 @@
   - template: jinja
   - require:
     - pkg: opencontrail_compute_packages
-  {%- if not grains.get('noservices', False)%}
   - watch_in:
     - service: opencontrail_compute_services
-  {%- endif %}
 
 /usr/local/bin/findns:
   file.managed:
@@ -76,10 +70,8 @@
   - source: salt://opencontrail/files/{{ compute.version }}/contrail-vrouter-nodemgr.ini
   - require:
     - pkg: opencontrail_compute_packages
-  {%- if not grains.get('noservices', False)%}
   - require_in:
     - service: opencontrail_compute_services
-  {%- endif %}
 
 /etc/udev/rules.d/vhost-net.rules:
   file.managed:
@@ -112,10 +104,8 @@
   - require:
     - pkg: opencontrail_compute_packages
     - pkg: opencontrail_vrouter_package
-  {%- if not grains.get('noservices', False)%}
   - require_in:
     - service: opencontrail_compute_services
-  {%- endif %}
 
 modules_dpdk:
   file.append:
@@ -157,11 +147,11 @@
 {%- endif %}
 {%- endif %}
 
-{%- if not grains.get('noservices', False)%}
-
 opencontrail_compute_services:
   service.enabled:
   - names: {{ compute.services }}
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
 
 {%- endif %}
-{%- endif %}
diff --git a/opencontrail/config.sls b/opencontrail/config.sls
index e7e28e0..17964b4 100644
--- a/opencontrail/config.sls
+++ b/opencontrail/config.sls
@@ -94,10 +94,8 @@
   - template: jinja
   - require:
     - pkg: opencontrail_config_packages
-{%- if not grains.get('noservices', False) %}
   - watch_in:
     - service: opencontrail_config_services
-{%- endif %}
 
 /etc/contrail/contrail-config-nodemgr.conf:
   file.managed:
@@ -105,10 +103,8 @@
   - template: jinja
   - require:
     - pkg: opencontrail_config_packages
-{%- if not grains.get('noservices', False) %}
   - watch_in:
     - service: opencontrail_config_services
-{%- endif %}
 
 /etc/sudoers.d/contrail_sudoers:
   file.managed:
@@ -124,11 +120,9 @@
   - template: jinja
   - require:
     - pkg: opencontrail_config_packages
-{%- if not grains.get('noservices', False) %}
   - watch_in:
     - service: opencontrail_config_services
 {%- endif %}
-{%- endif %}
 
 /etc/contrail/contrail-schema.conf:
   file.managed:
@@ -151,10 +145,8 @@
   - source: salt://opencontrail/files/{{ config.version }}/config/contrail-config-nodemgr.ini
   - require:
     - pkg: opencontrail_config_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_config_services
-{%- endif %}
 
 {%- if not grains.get('virtual_subtype', None) == "Docker" %}
 {%- if not common.vendor == "juniper" %}
@@ -163,10 +155,8 @@
   file.absent:
   - require:
     - pkg: opencontrail_config_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_config_services
-{%- endif %}
 
 {%- endif %}
 {%- endif %}
@@ -176,19 +166,18 @@
   - source: salt://opencontrail/files/{{ config.version }}/config/supervisord_config.conf
   - require:
     - pkg: opencontrail_config_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_config_services
-{%- endif %}
 
 {% endif %}
 
-{%- if not grains.get('noservices', False) %}
-
 opencontrail_config_services:
   service.running:
   - enable: true
   - names: {{ config.services }}
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch: 
     - file: /etc/contrail/contrail-discovery.conf
     - file: /etc/contrail/contrail-svc-monitor.conf
@@ -198,8 +187,6 @@
     - file: /etc/ifmap-server/basicauthusers.properties
     - file: /etc/sudoers.d/contrail_sudoers
 
-{%- endif %}
-
 {%- if grains.get('virtual_subtype', None) == "Docker" %}
 
 opencontrail_config_entrypoint:
diff --git a/opencontrail/control.sls b/opencontrail/control.sls
index 98bd146..1dcdf6b 100644
--- a/opencontrail/control.sls
+++ b/opencontrail/control.sls
@@ -51,37 +51,32 @@
   - makedirs: true
   - require:
     - pkg: opencontrail_control_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_control_services
-{%- endif %}
 
 /etc/contrail/supervisord_control.conf:
   file.managed:
   - source: salt://opencontrail/files/{{ control.version }}/control/supervisord_control.conf
   - require:
     - pkg: opencontrail_control_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_control_services
-{%- endif %}
 
 {% endif %}
 
-{%- if not grains.get('noservices', False) %}
-
 opencontrail_control_services:
   service.running:
   - enable: true
   - names: {{ control.services }}
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch:
     - file: /etc/contrail/dns/contrail-rndc.conf
     - file: /etc/contrail/contrail-dns.conf
     - file: /etc/contrail/contrail-control.conf
     - file: /etc/contrail/contrail-control-nodemgr.conf
 
-{%- endif %}
-
 {%- if grains.get('virtual_subtype', None) == "Docker" %}
 
 opencontrail_control_entrypoint:
diff --git a/opencontrail/database.sls b/opencontrail/database.sls
index cd9e043..2293117 100644
--- a/opencontrail/database.sls
+++ b/opencontrail/database.sls
@@ -109,22 +109,18 @@
   - template: jinja
   - require:
     - pkg: opencontrail_database_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_database_services
     - service: opencontrail_zookeeper_service
-{%- endif %}
 
 /etc/contrail/supervisord_database_files/contrail-database-nodemgr.ini:
   file.managed:
   - source: salt://opencontrail/files/{{ database.version }}/database/contrail-database-nodemgr.ini
   - require:
     - pkg: opencontrail_database_packages
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_database_services
     - service: opencontrail_zookeeper_service
-{%- endif %}
 
 {% endif %}
 
@@ -141,10 +137,8 @@
   - user: cassandra
   - group: cassandra
   - makedirs: True
-{%- if not grains.get('noservices', False) %}
   - require_in:
     - service: opencontrail_database_services
-{%- endif %}
 
 /var/lib/cassandra:
   file.directory:
@@ -153,12 +147,13 @@
   - require:
     - file: /var/lib/cassandra/data
 
-{%- if not grains.get('noservices', False) %}
-
 zookeeper_service:
   service.running:
   - enable: true
   - name: zookeeper
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch:
     - file: /etc/zookeeper/conf/zoo.cfg
     - file: /var/lib/zookeeper/myid
@@ -173,6 +168,9 @@
   - name: supervisor-database
 {%- endif %}
   - init_delay: 5
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch:
     - file: {{ database.cassandra_config }}cassandra.yaml
     - file: {{ database.cassandra_config }}cassandra-env.sh
@@ -187,13 +185,14 @@
   service.running:
   - enable: true
   - name: zookeeper
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch:
     - file: /etc/zookeeper/conf/zoo.cfg
     - file: /etc/default/zookeeper
     - file: /etc/zookeeper/conf/log4j.properties
 
-{%- endif %}
-
 {%- if grains.get('virtual_subtype', None) == "Docker" %}
 
 opencontrail_database_entrypoint:
diff --git a/opencontrail/web.sls b/opencontrail/web.sls
index 7d9105b..00c72bd 100644
--- a/opencontrail/web.sls
+++ b/opencontrail/web.sls
@@ -19,7 +19,6 @@
   - template: jinja
   - require:
     - pkg: opencontrail_web_packages
-{%- if not grains.get('noservices', False) %}
   - watch_in:
     - service: opencontrail_web_services
 
@@ -27,11 +26,12 @@
   service.running:
   - enable: true
   - names: {{ web.services }}
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - watch: 
     - file: /etc/contrail/config.global.js
 
-{%- endif %}
-
 {%- if grains.get('virtual_subtype', None) == "Docker" %}
 
 opencontrail_web_entrypoint: