Merge pull request #47803 from rallytime/bp-47703

Back-port #47703 to 2018.3
This commit is contained in:
Nicole Thomas 2018-05-23 16:12:30 -04:00 committed by GitHub
commit 2a270162d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)