diff options
Diffstat (limited to 'recipes-connectivity/kuksa-val/kuksa-client')
2 files changed, 106 insertions, 86 deletions
diff --git a/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch b/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch index d43a34322..e32e5c469 100644 --- a/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch +++ b/recipes-connectivity/kuksa-val/kuksa-client/0001-kuksa-client-Update-cmd2-completer-usage.patch @@ -1,7 +1,7 @@ -From cc4da8b14896739ac2966ecad0a5c82ab1de025c Mon Sep 17 00:00:00 2001 +From 89aa41f52d5946796ad8dea587cd848aef71c8c0 Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> -Date: Sat, 5 Aug 2023 13:26:55 -0400 -Subject: [PATCH 1/2] kuksa_viss_client: Update cmd2 completer usage +Date: Mon, 27 Nov 2023 15:31:02 -0500 +Subject: [PATCH 1/2] kuksa-client: Update cmd2 completer usage Update cmd2 usage to avoid using internal methods and fix breakage with newer versions of the cmd2 module. @@ -10,31 +10,22 @@ Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- - kuksa-client/kuksa_client/__main__.py | 31 +++++++++++++-------------- - 1 file changed, 15 insertions(+), 16 deletions(-) + kuksa-client/kuksa_client/__main__.py | 33 +++++++++++++-------------- + 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/kuksa-client/kuksa_client/__main__.py b/kuksa-client/kuksa_client/__main__.py -index 948cf56..fceca41 100755 +index 032410b..1d2d1fc 100755 --- a/kuksa-client/kuksa_client/__main__.py +++ b/kuksa-client/kuksa_client/__main__.py -@@ -35,7 +35,6 @@ from cmd2 import Cmd - from cmd2 import CompletionItem +@@ -36,7 +36,6 @@ from cmd2 import CompletionItem from cmd2 import with_argparser from cmd2 import with_category + from cmd2 import constants -from cmd2.utils import basic_complete + from urllib.parse import urlparse - import kuksa_certificates - from kuksa_client import KuksaClientThread -@@ -126,7 +125,7 @@ class TestClient(Cmd): - "Children of branch "+prefix+key), - ) - -- return basic_complete(text, line, begidx, endidx, self.pathCompletionItems) -+ return Cmd.basic_complete(self, text, line, begidx, endidx, self.pathCompletionItems) - - def subscribeCallback(self, logPath, resp): - with logPath.open('a', encoding='utf-8') as logFile: -@@ -136,7 +135,7 @@ class TestClient(Cmd): + from kuksa_client import kuksa_server_certificates +@@ -156,7 +155,7 @@ class TestClient(Cmd): self.pathCompletionItems = [] for sub_id in self.subscribeIds: self.pathCompletionItems.append(CompletionItem(sub_id)) @@ -43,99 +34,128 @@ index 948cf56..fceca41 100755 COMM_SETUP_COMMANDS = "Communication Set-up Commands" VSS_COMMANDS = "Kuksa Interaction Commands" -@@ -153,7 +152,7 @@ class TestClient(Cmd): +@@ -171,19 +170,19 @@ class TestClient(Cmd): + + ap_disconnect = argparse.ArgumentParser() + ap_authorize = argparse.ArgumentParser() +- tokenfile_completer_method = functools.partial( ++ tokenfile_completer = functools.partial( + Cmd.path_complete, + path_filter=lambda path: (os.path.isdir(path) or path.endswith(".token")), + ) ap_authorize.add_argument( - 'token_or_tokenfile', - help='JWT(or the file storing the token) for authorizing the client.', -- completer_method=tokenfile_completer_method,) -+ completer=tokenfile_completer_method,) - ap_setServerAddr = argparse.ArgumentParser() - ap_setServerAddr.add_argument( - 'IP', help='VISS/gRPC Server IP Address', default=DEFAULT_SERVER_ADDR) -@@ -168,7 +167,7 @@ class TestClient(Cmd): + "token_or_tokenfile", + help="JWT(or the file storing the token) for authorizing the client.", +- completer_method=tokenfile_completer_method, ++ completer=tokenfile_completer, + ) ap_setValue = argparse.ArgumentParser() ap_setValue.add_argument( -- "Path", help="Path to be set", completer_method=path_completer) -+ "Path", help="Path to be set", completer=path_completer) - ap_setValue.add_argument("Value", nargs='+', help="Value to be set") +- "Path", help="Path to be set", completer_method=path_completer ++ "Path", help="Path to be set", completer=path_completer + ) + ap_setValue.add_argument("Value", nargs="+", help="Value to be set") ap_setValue.add_argument( - "-a", "--attribute", help="Attribute to be set", default="value") -@@ -185,19 +184,19 @@ class TestClient(Cmd): +@@ -203,7 +202,7 @@ class TestClient(Cmd): ap_getValue = argparse.ArgumentParser() ap_getValue.add_argument( -- "Path", help="Path to be read", completer_method=path_completer) -+ "Path", help="Path to be read", completer=path_completer) +- "Path", help="Path to be read", completer_method=path_completer ++ "Path", help="Path to be read", completer=path_completer + ) ap_getValue.add_argument( - "-a", "--attribute", help="Attribute to be get", default="value") - - ap_getValues = argparse.ArgumentParser() - ap_getValues.add_argument( -- "Path", help="Path whose value is to be read", nargs='+', completer_method=path_completer) -+ "Path", help="Path whose value is to be read", nargs='+', completer=path_completer) + "-a", "--attribute", help="Attribute to be get", default="value" +@@ -214,7 +213,7 @@ class TestClient(Cmd): + "Path", + help="Path whose value is to be read", + nargs="+", +- completer_method=path_completer, ++ completer=path_completer, + ) ap_getValues.add_argument( - "-a", "--attribute", help="Attribute to be get", default="value") - - ap_setTargetValue = argparse.ArgumentParser() + "-a", "--attribute", help="Attribute to be get", default="value" +@@ -224,7 +223,7 @@ class TestClient(Cmd): ap_setTargetValue.add_argument( -- "Path", help="Path whose target value to be set", completer_method=path_completer) -+ "Path", help="Path whose target value to be set", completer=path_completer) + "Path", + help="Path whose target value to be set", +- completer_method=path_completer, ++ completer=path_completer, + ) ap_setTargetValue.add_argument("Value", help="Value to be set") - ap_setTargetValues = argparse.ArgumentParser() -@@ -210,35 +209,35 @@ class TestClient(Cmd): - - ap_getTargetValue = argparse.ArgumentParser() +@@ -240,7 +239,7 @@ class TestClient(Cmd): ap_getTargetValue.add_argument( -- "Path", help="Path whose target value is to be read", completer_method=path_completer) -+ "Path", help="Path whose target value is to be read", completer=path_completer) + "Path", + help="Path whose target value is to be read", +- completer_method=path_completer, ++ completer=path_completer, + ) ap_getTargetValues = argparse.ArgumentParser() - ap_getTargetValues.add_argument( -- "Path", help="Path whose target value is to be read", nargs='+', completer_method=path_completer) -+ "Path", help="Path whose target value is to be read", nargs='+', completer=path_completer) +@@ -248,12 +247,12 @@ class TestClient(Cmd): + "Path", + help="Path whose target value is to be read", + nargs="+", +- completer_method=path_completer, ++ completer=path_completer, + ) ap_subscribe = argparse.ArgumentParser() ap_subscribe.add_argument( -- "Path", help="Path to subscribe to", completer_method=path_completer) -+ "Path", help="Path to subscribe to", completer=path_completer) +- "Path", help="Path to subscribe to", completer_method=path_completer ++ "Path", help="Path to subscribe to", completer=path_completer + ) ap_subscribe.add_argument( - "-a", "--attribute", help="Attribute to subscribe to", default="value") + "-a", "--attribute", help="Attribute to subscribe to", default="value" +@@ -268,7 +267,7 @@ class TestClient(Cmd): ap_subscribeMultiple = argparse.ArgumentParser() ap_subscribeMultiple.add_argument( -- "Path", help="Path to subscribe to", nargs='+', completer_method=path_completer) -+ "Path", help="Path to subscribe to", nargs='+', completer=path_completer) +- "Path", help="Path to subscribe to", nargs="+", completer_method=path_completer ++ "Path", help="Path to subscribe to", nargs="+", completer=path_completer + ) ap_subscribeMultiple.add_argument( - "-a", "--attribute", help="Attribute to subscribe to", default="value") - - ap_unsubscribe = argparse.ArgumentParser() + "-a", "--attribute", help="Attribute to subscribe to", default="value" +@@ -284,18 +283,18 @@ class TestClient(Cmd): ap_unsubscribe.add_argument( -- "SubscribeId", help="Corresponding subscription Id", completer_method=subscriptionIdCompleter, -+ "SubscribeId", help="Corresponding subscription Id", completer=subscriptionIdCompleter, + "SubscribeId", + help="Corresponding subscription Id", +- completer_method=subscriptionIdCompleter, ++ completer=subscriptionIdCompleter, ) ap_getMetaData = argparse.ArgumentParser() ap_getMetaData.add_argument( -- "Path", help="Path whose metadata is to be read", completer_method=path_completer) -+ "Path", help="Path whose metadata is to be read", completer=path_completer) + "Path", + help="Path whose metadata is to be read", +- completer_method=path_completer, ++ completer=path_completer, + ) ap_updateMetaData = argparse.ArgumentParser() ap_updateMetaData.add_argument( -- "Path", help="Path whose MetaData is to update", completer_method=path_completer) -+ "Path", help="Path whose MetaData is to update", completer=path_completer) +- "Path", help="Path whose MetaData is to update", completer_method=path_completer ++ "Path", help="Path whose MetaData is to update", completer=path_completer + ) ap_updateMetaData.add_argument( "Json", - help="MetaData to update. Note, only attributes can be update, if update children or the whole vss tree, use" -@@ -249,7 +248,7 @@ class TestClient(Cmd): - jsonfile_completer_method = functools.partial(Cmd.path_complete, - path_filter=lambda path: (os.path.isdir(path) or path.endswith(".json"))) +@@ -304,14 +303,14 @@ class TestClient(Cmd): + ) + + ap_updateVSSTree = argparse.ArgumentParser() +- jsonfile_completer_method = functools.partial( ++ jsonfile_completer = functools.partial( + Cmd.path_complete, + path_filter=lambda path: (os.path.isdir(path) or path.endswith(".json")), + ) ap_updateVSSTree.add_argument( -- "Json", help="Json tree to update VSS", completer_method=jsonfile_completer_method) -+ "Json", help="Json tree to update VSS", completer=jsonfile_completer_method) + "Json", + help="Json tree to update VSS", +- completer_method=jsonfile_completer_method, ++ completer=jsonfile_completer, + ) # Constructor, request names after protocol to avoid errors - def __init__(self, server_ip=None, server_port=None, server_protocol=None, *, insecure=False, token_or_tokenfile=None, -- -2.41.0 +2.42.0 diff --git a/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch b/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch index f2c9ca34b..adc19e6f3 100644 --- a/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch +++ b/recipes-connectivity/kuksa-val/kuksa-client/0002-kuksa-client-Add-external-certificates-support.patch @@ -15,26 +15,26 @@ Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- kuksa-client/kuksa_client/cli_backend/__init__.py | 2 +- - kuksa_certificates/__init__.py | 7 ++++++- + kuksa-client/kuksa_client/kuksa_server_certificates/__init__.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kuksa-client/kuksa_client/cli_backend/__init__.py b/kuksa-client/kuksa_client/cli_backend/__init__.py -index f757cd6..f4d1f35 100644 +index 2cfe51e..96d94f2 100644 --- a/kuksa-client/kuksa_client/cli_backend/__init__.py +++ b/kuksa-client/kuksa_client/cli_backend/__init__.py -@@ -30,7 +30,7 @@ class Backend: +@@ -28,7 +28,7 @@ class Backend: self.insecure = config.getboolean('insecure', False) except AttributeError: self.insecure = config.get('insecure', False) -- self.default_cert_path = pathlib.Path(kuksa_certificates.__path__[0]) -+ self.default_cert_path = pathlib.Path(kuksa_certificates.__certificate_dir__) +- self.default_cert_path = pathlib.Path(kuksa_server_certificates.__path__[0]) ++ self.default_cert_path = pathlib.Path(kuksa_server_certificates.__certificate_dir__) self.cacertificate = config.get( 'cacertificate', str(self.default_cert_path / 'CA.pem')) self.certificate = config.get('certificate', str( -diff --git a/kuksa_certificates/__init__.py b/kuksa_certificates/__init__.py +diff --git a/kuksa-client/kuksa_client/kuksa_server_certificates/__init__.py b/kuksa-client/kuksa_client/kuksa_server_certificates/__init__.py index 22ccd3f..8323868 100644 ---- a/kuksa_certificates/__init__.py -+++ b/kuksa_certificates/__init__.py +--- a/kuksa-client/kuksa_client/kuksa_server_certificates/__init__.py ++++ b/kuksa-client/kuksa_client/kuksa_server_certificates/__init__.py @@ -2,4 +2,9 @@ import os from kuksa_client._metadata import * |