Skip to content

Commit 520cada

Browse files
authored
Sapcontrol local socket testing (#2)
* Fix local socket not handling do_open correctly Signed-off-by: Nicolas Bettembourg <[email protected]>
1 parent 3f313d7 commit 520cada

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

plugins/modules/sap_control_exec.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -286,33 +286,16 @@ def connect(self):
286286
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
287287
self.sock.connect(self.socketpath)
288288

289-
290289
class LocalSocketHandler(HTTPHandler):
291290
"""HTTP handler for Unix domain sockets."""
292291
def __init__(self, debuglevel=0, socketpath=None):
293-
HTTPHandler.__init__(self, debuglevel)
292+
self._debuglevel = debuglevel
294293
self._socketpath = socketpath
295294

296295
def http_open(self, req):
297296
return self.do_open(LocalSocketHttpConnection, req, socketpath=self._socketpath)
298297

299-
def do_open(self, http_class, req, **http_conn_args):
300-
"""Override to handle Unix socket connections."""
301-
host = req.host
302-
if not host:
303-
raise ValueError('no host given')
304-
305-
http_conn = http_class(host, **http_conn_args)
306-
http_conn.set_debuglevel(self._debuglevel)
307-
308-
try:
309-
http_conn.connect()
310-
r = http_conn.getresponse()
311-
except Exception as err:
312-
http_conn.close()
313-
raise err
314298

315-
return r
316299
def choices():
317300
retlist = ["Start", "Stop", "Shutdown", "InstanceStart", "InstanceStop", "Bootstrap", "ParameterValue", "GetProcessList",
318301
"GetProcessList2", "GetStartProfile", "GetTraceFile", "GetAlertTree", "GetAlerts", "RestartService",

0 commit comments

Comments
 (0)