Merge "Skip dbsync for contrail"
diff --git a/neutron/db/offline_sync.sls b/neutron/db/offline_sync.sls
index a646814..efb08a9 100644
--- a/neutron/db/offline_sync.sls
+++ b/neutron/db/offline_sync.sls
@@ -4,6 +4,11 @@
  - neutron.db.plugins.midonet
  - neutron.db.plugins.service.bgpvpn
 
+{%- set should_run = '/bin/true' %}
+{% if server.backend.engine == "contrail" or grains.get('noservices') or server.get('role', 'primary') == 'secondary' %}
+  {%- set should_run = '/bin/false' %}
+{%- endif %}
+
 {#- TODO(vsaienko): move this to map.jinja or pillars that should be included for specific plugins #}
 {%- set config_files = ['/etc/neutron/neutron.conf'] %}
 {%- if server.backend.engine in ["ml2", "ovn"] %}
@@ -14,13 +19,10 @@
 {%- do config_files.append('/etc/neutron/plugins/vmware/nsx.ini') %}
 {%- endif %}
 
-
 neutron_db_manage:
   cmd.run:
   - name: neutron-db-manage --config-file {{ ' --config-file '.join(config_files) }} upgrade head
-  {%- if grains.get('noservices') or server.get('role', 'primary') == 'secondary' %}
-  - onlyif: /bin/false
-  {%- endif %}
+  - onlyif: {{ should_run }}
   - require_in:
     - sls: neutron.db.plugins.service.bgpvpn
     - sls: neutron.db.plugins.midonet