From 03230480486f9b332b59e5729476d02361c0f7e3 Mon Sep 17 00:00:00 2001 From: BjoernAtBosch Date: Wed, 3 Jul 2024 14:16:27 +0200 Subject: [PATCH] Replace shell script by Python --- manifest.json | 5 +++- ...er-cli.sh => run-vehicledatabroker-cli.py} | 28 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) rename runtime_local/src/{run-vehicledatabroker-cli.sh => run-vehicledatabroker-cli.py} (50%) mode change 100755 => 100644 diff --git a/manifest.json b/manifest.json index 6c12020c..7c46ffb3 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,10 @@ "programs": [ { "id": "run-vehicledatabroker-cli", - "executable": "./runtime_local/src/run-vehicledatabroker-cli.sh" + "executable": "python3", + "args": [ + "./runtime_local/src/run-vehicledatabroker-cli.py" + ] }, { "id": "run-service", diff --git a/runtime_local/src/run-vehicledatabroker-cli.sh b/runtime_local/src/run-vehicledatabroker-cli.py old mode 100755 new mode 100644 similarity index 50% rename from runtime_local/src/run-vehicledatabroker-cli.sh rename to runtime_local/src/run-vehicledatabroker-cli.py index 7fb74e61..2ff7debf --- a/runtime_local/src/run-vehicledatabroker-cli.sh +++ b/runtime_local/src/run-vehicledatabroker-cli.py @@ -1,5 +1,4 @@ -#!/bin/bash -# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2024 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at @@ -13,8 +12,25 @@ # # SPDX-License-Identifier: Apache-2.0 -echo "#######################################################" -echo "### Running VehicleDataBroker CLI ###" -echo "#######################################################" +import subprocess -docker run -it --rm --network host $vehicleDatabrokerCliImage +from local_lib import get_container_runtime_executable +from velocitas_lib import require_env + + +def run_databroker_cli(): + databroker_cli_image = require_env("vehicleDatabrokerCliImage") + program_args = [ + get_container_runtime_executable(), + "run", + "-it", + "--rm", + "--network", + "host", + databroker_cli_image, + ] + subprocess.check_call(program_args) + + +if __name__ == "__main__": + run_databroker_cli()