created common.py for extracting deep comparision function.
This commit is contained in:
parent
31c955c5b9
commit
d6717a9adf
14
collection/plugins/modules/common.py
Normal file
14
collection/plugins/modules/common.py
Normal file
@ -0,0 +1,14 @@
|
||||
import json
|
||||
|
||||
def deep_equal(a, b):
|
||||
"""
|
||||
Compare two data structures for deep equality by converting them to JSON strings.
|
||||
|
||||
Parameters:
|
||||
a (any): First data structure to compare.
|
||||
b (any): Second data structure to compare.
|
||||
|
||||
Returns:
|
||||
bool: True if the two data structures are equal, False otherwise.
|
||||
"""
|
||||
return json.dumps(a, sort_keys=True) == json.dumps(b, sort_keys=True)
|
@ -151,11 +151,9 @@ response:
|
||||
'''
|
||||
|
||||
from ansible_collections.community.syncthing.plugins.module_utils.syncthing_api import SyncthingModule
|
||||
from common.py import deep_equal
|
||||
import json
|
||||
|
||||
def deep_equal(a, b):
|
||||
return json.dumps(a, sort_keys=True) == json.dumps(b, sort_keys=True)
|
||||
|
||||
def run_module():
|
||||
module_args = dict(
|
||||
addresses=dict(type='list', required=False),
|
||||
|
Loading…
Reference in New Issue
Block a user