Optimize noservices condition
diff --git a/etcd/server/service.sls b/etcd/server/service.sls
index 3e1fba1..e43f2a0 100644
--- a/etcd/server/service.sls
+++ b/etcd/server/service.sls
@@ -9,10 +9,8 @@
{%- if server.get('engine', 'systemd') %}
- require:
- file: /etc/default/etcd
- {% if not grains.get('noservices', False) %}
- watch_in:
- service: etcd
- {% endif %}
{%- endif %}
@@ -84,10 +82,8 @@
- group: root
- require:
- dockerng: copy-etcd-binaries
- {% if not grains.get('noservices', False) %}
- watch_in:
- service: etcd
- {% endif %}
{% endfor %}
@@ -135,10 +131,8 @@
{%- else %}
initial_cluster_state: existing
{%- endif %}
- {% if not grains.get('noservices', False) %}
- watch_in:
- service: etcd
- {% endif %}
/var/lib/etcd/:
file.directory:
@@ -154,14 +148,13 @@
- require:
- file: /var/lib/etcd/
-{% if not grains.get('noservices', False) %}
-
etcd:
service.running:
- enable: True
- name: {{ server.services }}
-
-{%- endif %}
+ {% if grains.noservices is defined %}
+ - onlyif: {% if grains.get('noservices', "True") %}"True"{% else %}False{% endif %}
+ {% endif %}
{%- endif %}