Skip to content

Commit

Permalink
Fix elasticsearch with check_definition
Browse files Browse the repository at this point in the history
  • Loading branch information
babs committed May 17, 2018
1 parent 9ee2786 commit e142eb1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions salt/states/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,10 @@ def index_template_present(name, definition, check_definition=False):
ret['comment'] = 'Cannot create index template {0}, {1}'.format(name, output)
else:
if check_definition:
definition_parsed = salt.utils.json.loads(definition)
definition_to_diff = {'aliases': {}, 'mappings': {}, 'settings': {}}
definition_to_diff.update(definition)
current_template = __salt__['elasticsearch.index_template_get'](name=name)[name]
diff = __utils__['dictdiffer.deep_diff'](current_template, definition_parsed)
diff = __utils__['dictdiffer.deep_diff'](current_template, definition_to_diff)
if len(diff) != 0:
if __opts__['test']:
ret['comment'] = 'Index template {0} exist but need to be updated'.format(name)
Expand Down

0 comments on commit e142eb1

Please sign in to comment.