From: Martin Polreich Date: Mon, 12 Jun 2017 17:16:48 +0000 (+0200) Subject: Optimize 'noservices' condition X-Git-Url: https://gerrit.mcp.mirantis.com/gitweb?p=salt-formulas%2Finfluxdb.git;a=commitdiff_plain;h=da2aef69ef58af61bd4984b3c5446e87ce5224c7 Optimize 'noservices' condition --- diff --git a/influxdb/server.sls b/influxdb/server.sls index 4276a8e..0be829f 100644 --- a/influxdb/server.sls +++ b/influxdb/server.sls @@ -30,8 +30,6 @@ influxdb_default: - require: - pkg: influxdb_packages -{%- if not grains.get('noservices', False) %} - influxdb_service: service.running: - enable: true @@ -39,12 +37,13 @@ influxdb_service: # This delay is needed before being able to send data to server to create # users and databases. - init_delay: 5 + {%- if grains.get('noservices') %} + - onlyif: /bin/false + {%- endif %} - watch: - file: influxdb_config - file: influxdb_default -{%- endif %} - {% set url_for_query = "http://{}:{}/query".format(server.http.bind.address, server.http.bind.port) %} {% set admin_created = false %} @@ -54,10 +53,8 @@ influxdb_service: influxdb_create_admin: cmd.run: - name: curl -f -S -POST "{{ url_for_query }}" {{ query_create_admin }} || curl -f -S -POST "{{ admin_url }}" {{ query_create_admin }} - {%- if not grains.get('noservices', False) %} - require: - service: influxdb_service - {%- endif %} {% set url_for_query = admin_url %} {% set admin_created = true %} {%- endif %}