#NEWLINE# def compare_dicts( old = None , new = None ) : #NEWLINE# #INDENT# '\n    Compare before and after results from various salt functions, returning a\n    dict describing the changes that were made.\n    ' #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for key in set ( ( new or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) . union ( ( old or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) : #NEWLINE# #INDENT# if ( key not in old ) : #NEWLINE# #INDENT# ret [ key ] = { #NEWLINE# #INDENT# 'old' : '' , #NEWLINE# 'new' : new [ key ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key not in new ) : #NEWLINE# #INDENT# ret [ key ] = { #NEWLINE# #INDENT# 'new' : '' , #NEWLINE# 'old' : old [ key ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( new [ key ] != old [ key ] ) : #NEWLINE# #INDENT# ret [ key ] = { #NEWLINE# #INDENT# 'old' : old [ key ] , #NEWLINE# 'new' : new [ key ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return ret