Fix dockerng_services for OC4.X

Change-Id: I33356820ac2ba658972f38f3e20dc8c16d2bd05f
diff --git a/opencontrail/collector.sls b/opencontrail/collector.sls
index 34169ec..f9b5198 100644
--- a/opencontrail/collector.sls
+++ b/opencontrail/collector.sls
@@ -129,6 +129,7 @@
 
 {%- else %}
 {%- if collector.container_name is defined %}
+{%- if salt['dockerng.exists'](collector.container_name) %}
 opencontrail_collector_dockerng_services:
   dockerng_service.running:
   - services: {{ collector.services }}
@@ -143,6 +144,7 @@
     - file: /etc/contrail/contrail-analytics-nodemgr.conf
     - file: /etc/contrail/contrail-alarm-gen.conf
 {%- endif%}
+{%- endif%}
 {%- endif %}
 
 {%- endif %}
diff --git a/opencontrail/config.sls b/opencontrail/config.sls
index 67d1c5a..ea996df 100644
--- a/opencontrail/config.sls
+++ b/opencontrail/config.sls
@@ -228,6 +228,7 @@
 
 {%- else %}
 {%- if config.container_name is defined %}
+{%- if salt['dockerng.exists'](config.container_name) %}
 opencontrail_config_dockerng_services:
   dockerng_service.running:
     - services: {{ config.services }}
@@ -243,6 +244,7 @@
       - file: /etc/contrail/contrail-keystone-auth.conf
       {%- endif %}
 {%- endif%}
+{%- endif%}
 
 {%- endif %}
 
diff --git a/opencontrail/control.sls b/opencontrail/control.sls
index 2300968..988eb0c 100644
--- a/opencontrail/control.sls
+++ b/opencontrail/control.sls
@@ -118,6 +118,7 @@
 
 {%- else %}
 {%- if control.container_name is defined %}
+{%- if salt['dockerng.exists'](control.container_name) %}
 opencontrail_control_dockerng_services:
   dockerng_service.running:
     - services: {{ control.services }}
@@ -127,6 +128,8 @@
       - file: /etc/contrail/contrail-dns.conf
       - file: /etc/contrail/contrail-control.conf
       - file: /etc/contrail/contrail-control-nodemgr.conf
+
+{%- endif %}
 {%- endif %}
 {%- endif %}
 
diff --git a/opencontrail/database.sls b/opencontrail/database.sls
index e7a411f..56a3d61 100644
--- a/opencontrail/database.sls
+++ b/opencontrail/database.sls
@@ -278,6 +278,7 @@
 
 {%- else %}
 {%- if database.container_name is defined %}
+{%- if salt['dockerng.exists'](database.container_name) %}
 opencontrail_database_dockerng_services:
   dockerng_service.running:
     - services:
@@ -301,3 +302,5 @@
 {%- endif %}
 
 {%- endif %}
+
+{%- endif %}
diff --git a/opencontrail/web.sls b/opencontrail/web.sls
index e31db89..9422efa 100644
--- a/opencontrail/web.sls
+++ b/opencontrail/web.sls
@@ -59,6 +59,7 @@
   - template: jinja
 
 {%- if web.container_name is defined %}
+{%- if salt['dockerng.exists'](web.container_name) %}
 opencontrail_web_dockerng_services:
   dockerng_service.running:
     - services:
@@ -69,6 +70,7 @@
       - file: /etc/contrail/config.global.js
       - file: /etc/contrail/contrail-webui-userauth.js
 {%- endif%}
+{%- endif%}
 
 {%- endif %}