syncthing_folder: Default to empty device list

When defining a new shared folder, the configuration is missing and
thus there are no current devices configured.
This commit is contained in:
Borjan Tchakaloff 2021-02-17 18:05:08 +01:00
parent 1b2952c1a6
commit 6777a9ab6a

View File

@ -280,7 +280,9 @@ def run_module():
break break
else: else:
folder_config = get_folder_config(module.params['id'], config) folder_config = get_folder_config(module.params['id'], config)
folder_config_devices = [d['deviceID'] for d in folder_config['devices']] folder_config_devices = (
[d['deviceID'] for d in folder_config['devices']] if folder_config else []
)
folder_config_wanted = create_folder(module.params, folder_config_devices) folder_config_wanted = create_folder(module.params, folder_config_devices)
if folder_config is None: if folder_config is None: