test - get devices

This commit is contained in:
Swapnil 2024-05-08 01:07:03 +05:30
parent 0c93969c8e
commit aa914a89d4
Signed by: swapnil
GPG Key ID: 58029C48BB100574
1 changed files with 5 additions and 1 deletions

View File

@ -81,6 +81,9 @@ response:
from ansible_collections.community.syncthing.plugins.module_utils.syncthing_api import SyncthingModule
def deep_equal(a, b):
return json.dumps(a, sort_keys=True) == json.dumps(b, sort_keys=True)
# Returns an object of a new folder
def create_folder(params, self_id, existing_device_ids):
wanted_device_ids = {self_id}
@ -221,7 +224,8 @@ def run_module():
folder_with_updated_data = update_folder(
folder, module.params, self_id, existing_device_ids
)
module.patch_call(data=folder_with_updated_data, target=folder['id'])
if not deep_equal(folder, folder_with_updated_data):
module.patch_call(data=folder_with_updated_data, target=folder['id'])
else: # Doesn't exist but needs to be added
if module.check_mode:
module.result['changed'] = True