From f86be16f6d83b3d234fc3e68326037b1872d668a Mon Sep 17 00:00:00 2001 From: Erik Jaegervall Date: Mon, 12 Feb 2024 15:25:03 +0100 Subject: [PATCH] Improve handling of updateVSSTree for Databroker --- kuksa-client/kuksa_client/__main__.py | 8 +++++--- kuksa-client/kuksa_client/cli_backend/grpc.py | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kuksa-client/kuksa_client/__main__.py b/kuksa-client/kuksa_client/__main__.py index 032410b..224f85b 100755 --- a/kuksa-client/kuksa_client/__main__.py +++ b/kuksa-client/kuksa_client/__main__.py @@ -159,7 +159,8 @@ def subscriptionIdCompleter(self, text, line, begidx, endidx): return basic_complete(text, line, begidx, endidx, self.pathCompletionItems) COMM_SETUP_COMMANDS = "Communication Set-up Commands" - VSS_COMMANDS = "Kuksa Interaction Commands" + VSS_COMMANDS = "Kuksa Interaction Commands (Supported by both KUKSA Databroker and KUKSA Server)" + VSS_COMMANDS_SERVER = "Kuksa Interaction Commands (Only supported by KUKSA Server)" INFO_COMMANDS = "Info Commands" ap_connect = argparse.ArgumentParser() @@ -526,13 +527,14 @@ def getMetaData(self, path): return self.commThread.getMetaData(path) return "{}" - @with_category(VSS_COMMANDS) + @with_category(VSS_COMMANDS_SERVER) @with_argparser(ap_updateVSSTree) def do_updateVSSTree(self, args): """Update VSS Tree Entry""" if self.checkConnection(): resp = self.commThread.updateVSSTree(args.Json) - print(highlight(resp, lexers.JsonLexer(), formatters.TerminalFormatter())) + if resp is not None: + print(highlight(resp, lexers.JsonLexer(), formatters.TerminalFormatter())) @with_category(VSS_COMMANDS) @with_argparser(ap_updateMetaData) diff --git a/kuksa-client/kuksa_client/cli_backend/grpc.py b/kuksa-client/kuksa_client/cli_backend/grpc.py index c74a5ae..3159bde 100644 --- a/kuksa-client/kuksa_client/cli_backend/grpc.py +++ b/kuksa-client/kuksa_client/cli_backend/grpc.py @@ -259,6 +259,10 @@ async def _grpcHandler(self, vss_client: kuksa_client.grpc.aio.VSSClient): self.grpcConnected = False + # Update VSS Tree Entry + def updateVSSTree(self, jsonStr, timeout=5): + print("Command not supported by KUKSA Databroker or KUKSA gRPC!") + # Main loop for handling gRPC communication async def mainLoop(self): if self.insecure: