MCPcopy Create free account
hub / github.com/PiSCSI/piscsi / send_pb_command

Method send_pb_command

python/web/src/socket_cmds_flask.py:25–45  ·  view source on GitHub ↗

Takes a (str) containing a serialized protobuf as argument. Establishes a socket connection with PiSCSI.

(self, payload)

Source from the content-addressed store, hash-verified

23 super().__init__(host, port)
24
25 def send_pb_command(self, payload):
26 """
27 Takes a (str) containing a serialized protobuf as argument.
28 Establishes a socket connection with PiSCSI.
29 """
30 try:
31 return super().send_pb_command(payload)
32 except FailedSocketConnectionException as err:
33 # After failing all attempts, throw a 404 error
34 abort(
35 404,
36 _(
37 "The PiSCSI Web Interface failed to connect to PiSCSI at "
38 "%(host)s:%(port)s with error: %(error_msg)s. The PiSCSI "
39 "process is not running or may have crashed.",
40 host=self.host,
41 port=self.port,
42 error_msg=str(err),
43 ),
44 )
45 return None
46
47 def send_over_socket(self, sock, payload):
48 """Sends a payload over a given socket"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected