Merge pull request #40235 from lorengordon/lgpo-deepdiff

Uses a deep diff to compare lgpo policy changes
This commit is contained in:
Mike Place 2017-03-22 16:31:20 -06:00 committed by GitHub
commit cae6a378f9

View File

@ -108,6 +108,9 @@ from __future__ import absolute_import
import logging import logging
import json import json
# Import salt libs
import salt.utils.dictdiffer
# Import 3rd party libs # Import 3rd party libs
import salt.ext.six as six import salt.ext.six as six
@ -298,10 +301,11 @@ def set_(name,
adml_language=adml_language) adml_language=adml_language)
if _ret: if _ret:
ret['result'] = _ret ret['result'] = _ret
ret['changes']['old'] = current_policy ret['changes'] = salt.utils.dictdiffer.deep_diff(
ret['changes']['new'] = __salt__['lgpo.get'](policy_class=policy_class, current_policy,
adml_language=adml_language, __salt__['lgpo.get'](policy_class=policy_class,
hierarchical_return=False) adml_language=adml_language,
hierarchical_return=False))
else: else:
ret['result'] = False ret['result'] = False
ret['comment'] = 'Errors occurred while attempting to configure policies: {0}'.format(_ret) ret['comment'] = 'Errors occurred while attempting to configure policies: {0}'.format(_ret)