From 8e2485396551a973000e3a52ae48a4fc282a0872 Mon Sep 17 00:00:00 2001 From: mrdubr Date: Wed, 24 Jul 2024 10:07:12 -0400 Subject: [PATCH] Handle unspecified ports for pod creation --- README.md | 16 ++++++++++++++++ contents/common.py | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 28319c4..670239b 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,22 @@ python setup.py install Run `gradle build` to build the zip file. Then, copy the zip file to the `$RDECK_BASE\libext` folder. +## Testing + +To run the tests specified in the `tox.ini` file, follow these steps: + +- Install Tox: Ensure you have Tox installed. You can install it using pip: + ```sh + pip install tox + ``` +- Run Tox: Execute Tox in the directory containing the `tox.ini` file. This will run the tests in all specified environments: + ```sh + tox + ``` +- Run Specific Environment: If you want to run tests for a specific environment (e.g., Python 3.8), you can specify the environment: + ```sh + tox -e py38 + ``` ## Authentication diff --git a/contents/common.py b/contents/common.py index 34b9f6f..c784876 100644 --- a/contents/common.py +++ b/contents/common.py @@ -323,11 +323,12 @@ def parseJson(obj): def create_pod_template_spec(data): - ports = [] - for port in data["ports"].split(','): - portDefinition = client.V1ContainerPort(container_port=int(port)) - ports.append(portDefinition) + ports = [] + if data["ports"]: + for port in data["ports"].split(','): + portDefinition = client.V1ContainerPort(container_port=int(port)) + ports.append(portDefinition) envs = [] if "environments" in data: