Merge pull request #27 from Martin819/master

Optimize 'noservices' condition
diff --git a/nova/compute.sls b/nova/compute.sls
index 584dbe4..b16c97a 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -189,7 +189,6 @@
   - template: jinja
   - require:
     - pkg: nova_compute_packages
-{%- if not grains.get('noservices', False) %}
   - watch_in:
     - service: {{ compute.libvirt_service }}
 
@@ -205,7 +204,6 @@
 
 {%- endif %}
 {%- endif %}
-{%- endif %}
 
 /etc/libvirt/qemu.conf:
   file.managed:
@@ -228,17 +226,18 @@
     - pkg: nova_compute_packages
   - onlyif: "virsh net-list | grep default"
 
-{%- if not grains.get('noservices', False) %}
 {{ compute.libvirt_service }}:
   service.running:
   - enable: true
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - require:
     - pkg: nova_compute_packages
     - cmd: virsh net-undefine default
   - watch:
     - file: /etc/libvirt/{{ compute.libvirt_config }}
     - file: /etc/libvirt/qemu.conf
-{%- endif %}
 
 {%- if grains.get('init', None) == "upstart" %}
 # MOS9 libvirt fix for upstart
diff --git a/nova/controller.sls b/nova/controller.sls
index 0a8ac8f..006a541 100644
--- a/nova/controller.sls
+++ b/nova/controller.sls
@@ -93,15 +93,15 @@
 
 {%- endfor %}
 
-{%- if not grains.get('noservices', False) %}
-
 {%- if controller.version in ["mitaka", "newton", "ocata"] %}
 nova_controller_sync_apidb:
   cmd.run:
   - name: nova-manage api_db sync
+  {%- if grains.get('noservices') %}
+  - onlyif: /bin/false
+  {%- endif %}
   - require:
     - file: /etc/nova/nova.conf
-{%- endif %}
 
 {%- if controller.version in ["newton", "ocata"] %}
 nova_controller_online_data_migrations: