Fixes
All checks were successful
buildbot/multibuild_parent Build done.
buildbot/travis_bionic Build done.

This commit is contained in:
Peter Šurda 2024-04-23 12:12:40 +08:00
parent 29d43b9ef0
commit 2c26c3a53e
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95
2 changed files with 12 additions and 12 deletions

View File

@ -14,7 +14,7 @@ else:
DEFAULT_ST_CONFIG_LOCATION = '$HOME/.local/state/syncthing/config.xml'
class SyncthingBase(AnsibleModule):
class SyncthingModule(AnsibleModule):
def _make_headers(self, target=None):
url = '{}{}{}{}'.format(
self.params['host'],
@ -87,23 +87,24 @@ class SyncthingBase(AnsibleModule):
return self._api_call(method='PATCH', data=data, target=target)
def exit_json(self):
super().exit_json(**self.module.result)
super().exit_json(**self.result)
def fail_json(self, msg=""):
super().fail_json(msg, **self.module.result)
super().fail_json(msg, **self.result)
def __init__(self, api_url='/', module_args=None, supports_check_mode=True):
module_args_temp = url_argument_spec()
module_args_temp.update(dict(
def __init__(self, api_url='/', argument_spec=None, supports_check_mode=True):
self.api_url = api_url
argument_spec_temp = url_argument_spec()
argument_spec_temp.update(dict(
host=dict(type='str', default='http://127.0.0.1:8384'),
unix_socket=dict(type='str', required=False),
api_key=dict(type='str', required=False, no_log=True),
config_file=dict(type='str', required=False),
timeout=dict(type='int', default=30),
))
if module_args is None:
module_args = {}
module_args_temp.update(module_args)
super().__init__(module_args=module_args_temp, supports_check_mode=True)
if argument_spec is None:
argument_spec = {}
argument_spec_temp.update(argument_spec)
super().__init__(argument_spec=argument_spec_temp, supports_check_mode=True)
# Auto-configuration: Try to fetch API key from filesystem
if not self.params['api_key']:

View File

@ -78,8 +78,7 @@ response:
type: dict
'''
from ansible.collections.syncthing.plugins.module_utils.syncthing_api \
import SyncthingModule
from ansible_collections.community.syncthing.plugins.module_utils.syncthing_api import SyncthingModule
# Returns an object of a new device
def create_device(params):