X-Git-Url: https://gerrit.mcp.mirantis.com/gitweb?p=salt-formulas%2Felasticsearch.git;a=blobdiff_plain;f=elasticsearch%2Fclient%2Finit.sls;h=b8ceb57a1c7c58566b15f2c563f577f3abb752d1;hp=18f4ffc49d7b462910c882d8b99527f8f79bdaf8;hb=9a9f382a09402533cf32f3ea90c0f769d885aa62;hpb=f9ede3488d97b79439c0d04a847db14d750b8f6b diff --git a/elasticsearch/client/init.sls b/elasticsearch/client/init.sls index 18f4ffc..b8ceb57 100644 --- a/elasticsearch/client/init.sls +++ b/elasticsearch/client/init.sls @@ -17,7 +17,7 @@ include: # Since bug in retry logic in salt (#49895) we need to use a workaround for now. elasticsearch_check_cluster_status_before_creating_index_{{ index_name }}: cmd.run: - - name: curl -sf {{ client.server.host }}:{{ client.server.port }}/_cat/health | awk '{print $4}' | grep green + - name: curl -sfk {{ client.server.get("scheme", "http") }}://{{ client.server.host }}:{{ client.server.port }}/_cat/health | awk '{print $4}' | grep green - retry: attempts: 5 until: True @@ -27,7 +27,7 @@ elasticsearch_check_cluster_status_before_creating_index_{{ index_name }}: elasticsearch_index_{{ index_name }}: {%- if index.get('enabled', False) %} - {% set operation = 'create' %} + {% set operation = 'present' %} {%- if index.definition is defined %} {% set definition = index.definition %} @@ -67,14 +67,8 @@ elasticsearch_index_{{ index_name }}: {%- if index.get('force_operation', False) %} elasticsearch_index_{{ index_name }}_{{ operation }}: {% set curdate = None | strftime('%Y.%m.%d') %} - module.run: - - name: elasticsearch.index_{{ operation }} - - index: {{ index_name }}-{{ curdate }} -{%- else %} -elasticsearch_index_{{ index_name }}_{{ operation }}: - module.run: - - name: elasticsearch.index_{{ operation }} - - index: {{ index_name }} + elasticsearch.index_{{ operation }}: + - name: {{ index_name }}-{{ curdate }} {%- endif %} {%- endfor %}