I’m analyzing how to upgrade from a Rest API to a websocket call.
One of the Rest APIs in use is:
POST filesystem.get .....
which returns the contents of a configuration file I have locally.
This API works without problems ( API REst) with
truenas 24.10.2.3
truenas 25.04.x
truenas 25.10.x
Using truenas_api_client, I get this error when using this call:
resp = conn.call(“filesystem.get”, ‘“/mnt/ixapps/my_config.yaml”’)
or
resp = conn.call(“filesystem.get”, ‘/mnt/ixapps/my_config.yaml’)
where conn is instance of Client(uri=“wss://…/api/current”, verify_ssl=False)
an exception occurs:
exception |Pipe ‘output’ is not open|
method: filesystem.get
endpoint: wss://…/api/current
params: ‘“/mnt/ixapps/my_config.yaml”’ or ‘/mnt/ixapps/my_config.yaml’
PS: Before implementing this method, I tested the conversion from Rest API to → call with truenas_api_client, on over 30 APIs and I had no problems, so the connection, credentials, and rest are correct.
(A dedicated class has been defined.)
root@DC310[~]# midclt call filesystem.get /mnt/ixapps/my_docker_compose_wd.yml
Pipe ‘output’ is not open
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/api/base/server/ws_handler/rpc.py”, line 354, in process_method_call
result = await method.call(app, id_, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/api/base/server/method.py”, line 57, in call
result = await self.middleware.call_with_audit(self.name, self.serviceobj, methodobj, params, app,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 954, in call_with_audit
result = await self._call(method, serviceobj, methodobj, params, app=app,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 764, in _call
prepared_call = self._call_prepare(name, serviceobj, methodobj, params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 735, in _call_prepare
job = Job(self, name, serviceobj, methodobj, params, job_options, pipes, job_on_progress_cb, app,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 332, in init
self.check_pipe(pipe)
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 376, in check_pipe
raise ValueError(“Pipe %r is not open” % pipe)
ValueError: Pipe ‘output’ is not open