Refactoring
- unix_socket still wasn't used correctly
This commit is contained in:
parent
b6ec505285
commit
fb178b36cd
|
@ -121,11 +121,12 @@ def get_key_from_filesystem(module):
|
||||||
|
|
||||||
# Fetch Syncthing configuration
|
# Fetch Syncthing configuration
|
||||||
def remote_config(module, method='GET', config=None, result=None, device=None):
|
def remote_config(module, method='GET', config=None, result=None, device=None):
|
||||||
|
unix_socket = None
|
||||||
|
if 'unix_socket' in module.params:
|
||||||
|
unix_socket = module.params['unix_socket']
|
||||||
url, headers = make_headers(
|
url, headers = make_headers(
|
||||||
host=module.params['host'],
|
host=module.params['host'],
|
||||||
unix_socket=module.params['unix_socket']
|
unix_socket=unix_socket,
|
||||||
if 'unix_socket' in module.params
|
|
||||||
else None,
|
|
||||||
api_key= module.params['api_key'],
|
api_key= module.params['api_key'],
|
||||||
device=device)
|
device=device)
|
||||||
data = config
|
data = config
|
||||||
|
@ -135,14 +136,10 @@ def remote_config(module, method='GET', config=None, result=None, device=None):
|
||||||
if not result:
|
if not result:
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
if 'unix_socket' in module.params:
|
resp, info = fetch_url(
|
||||||
resp, info = fetch_url(
|
module, url=url, unix_socket=unix_socket,
|
||||||
module, unix_socket=url, data=data, headers=headers,
|
data=data, headers=headers,
|
||||||
method=method, timeout=module.params['timeout'])
|
method=method, timeout=module.params['timeout'])
|
||||||
else:
|
|
||||||
resp, info = fetch_url(
|
|
||||||
module, url, data=data, headers=headers,
|
|
||||||
method=method, timeout=module.params['timeout'])
|
|
||||||
|
|
||||||
if not info or info['status'] != 200:
|
if not info or info['status'] != 200:
|
||||||
result['response'] = info
|
result['response'] = info
|
||||||
|
|
Loading…
Reference in New Issue
Block a user