Skip to content

Commit 0fe46d1

Browse files
authored
Merge pull request #176 from rundeck-plugins/RUN-2676
RUN-2676 : Overhaul
2 parents 1526202 + 6a1a32d commit 0fe46d1

File tree

8 files changed

+68
-40
lines changed

8 files changed

+68
-40
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: [ '2.x', '3.x' ]
12+
python-version: [ '3.x' ]
1313

1414
steps:
1515
- uses: actions/checkout@v3

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ gradle-app.setting
2424
# End of https://www.gitignore.io/api/java,gradle
2525

2626

27-
.DS_Store
27+
.DS_Store
28+
29+
# Testing content
30+
.tox
31+
32+
**/__pycache__
33+
34+
/kubernetes_rundeck_plugin.egg-info/*

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ python setup.py install
3333

3434
Run `gradle build` to build the zip file. Then, copy the zip file to the `$RDECK_BASE\libext` folder.
3535

36+
## Testing
37+
38+
To run the tests specified in the `tox.ini` file, follow these steps:
39+
40+
- Install Tox: Ensure you have Tox installed. You can install it using pip:
41+
```sh
42+
pip install tox
43+
```
44+
- Run Tox: Execute Tox in the directory containing the `tox.ini` file. This will run the tests in all specified environments:
45+
```sh
46+
tox
47+
```
48+
- Run Specific Environment: If you want to run tests for a specific environment (e.g., Python 3.8), you can specify the environment:
49+
```sh
50+
tox -e py38
51+
```
3652

3753
## Authentication
3854

contents/common.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ def parseJson(obj):
323323

324324

325325
def create_pod_template_spec(data):
326-
ports = []
327326

328-
for port in data["ports"].split(','):
329-
portDefinition = client.V1ContainerPort(container_port=int(port))
330-
ports.append(portDefinition)
327+
ports = []
328+
if data["ports"]:
329+
for port in data["ports"].split(','):
330+
portDefinition = client.V1ContainerPort(container_port=int(port))
331+
ports.append(portDefinition)
331332

332333
envs = []
333334
if "environments" in data:

contents/deployment-update.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ def create_deployment_object(data):
106106
template.metadata = client.V1ObjectMeta(labels=labels)
107107

108108
# Create the specification of deployment
109-
spec = client.ExtensionsV1beta1DeploymentSpec(
109+
spec = client.V1DeploymentSpec(
110110
replicas=int(data["replicas"]),
111-
template=template)
111+
template=template,
112+
selector=client.V1LabelSelector(
113+
match_labels={} # This will match all pods
114+
)
115+
)
112116
# Instantiate the deployment object
113-
deployment = client.ExtensionsV1beta1Deployment(
117+
deployment = client.V1Deployment(
114118
api_version=data["api_version"],
115119
kind="Deployment",
116120
metadata=client.V1ObjectMeta(labels=labels,

contents/pods-resource-model.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ def nodeCollectData(pod, container, defaults, taglist, mappingList, boEmoticon):
137137
data['terminated'] = terminated
138138

139139
# Add labels as its own map of node attributes.
140-
for key, value in pod.metadata.labels.items():
141-
data['labels:' + key] = value
140+
if pod.metadata.labels is not None:
141+
for key, value in pod.metadata.labels.items():
142+
data['labels:' + key] = value
142143

143144
emoticon = ""
144145
if default_settings['default:status'] == "running":

plugin.yaml

+27-27
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ providers:
195195
groupName: Advanced
196196
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
197197
type: Select
198-
values: "python,python2,python3"
198+
values: "python,python3"
199199
default: "python"
200200
required: true
201201
scope: Instance
@@ -267,7 +267,7 @@ providers:
267267
groupName: Advanced
268268
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
269269
type: Select
270-
values: "python,python2,python3"
270+
values: "python,python3"
271271
default: "python"
272272
required: true
273273
scope: Instance
@@ -285,7 +285,7 @@ providers:
285285
title: "API Version"
286286
description: "Kubernetes API Version"
287287
required: true
288-
default: "extensions/v1beta1"
288+
default: "apps/v1"
289289
renderingOptions:
290290
groupName: Metadata
291291
- name: name
@@ -476,7 +476,7 @@ providers:
476476
groupName: Advanced
477477
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
478478
type: Select
479-
values: "python,python2,python3"
479+
values: "python,python3"
480480
default: "python"
481481
required: true
482482
scope: Instance
@@ -494,7 +494,7 @@ providers:
494494
title: "API Version"
495495
description: "Kubernetes API Version"
496496
required: true
497-
default: "extensions/v1beta1"
497+
default: "apps/v1"
498498
renderingOptions:
499499
groupName: Metadata
500500
- name: name
@@ -652,7 +652,7 @@ providers:
652652
groupName: Advanced
653653
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
654654
type: Select
655-
values: "python,python2,python3"
655+
values: "python,python3"
656656
default: "python"
657657
required: true
658658
scope: Instance
@@ -727,7 +727,7 @@ providers:
727727
groupName: Advanced
728728
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
729729
type: Select
730-
values: "python,python2,python3"
730+
values: "python,python3"
731731
default: "python"
732732
required: true
733733
scope: Instance
@@ -802,7 +802,7 @@ providers:
802802
groupName: Advanced
803803
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
804804
type: Select
805-
values: "python,python2,python3"
805+
values: "python,python3"
806806
default: "python"
807807
required: true
808808
scope: Instance
@@ -877,7 +877,7 @@ providers:
877877
groupName: Advanced
878878
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
879879
type: Select
880-
values: "python,python2,python3"
880+
values: "python,python3"
881881
default: "python"
882882
required: true
883883
scope: Instance
@@ -964,7 +964,7 @@ providers:
964964
groupName: Advanced
965965
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
966966
type: Select
967-
values: "python,python2,python3"
967+
values: "python,python3"
968968
default: "python"
969969
required: true
970970
scope: Instance
@@ -1051,7 +1051,7 @@ providers:
10511051
groupName: Advanced
10521052
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
10531053
type: Select
1054-
values: "python,python2,python3"
1054+
values: "python,python3"
10551055
default: "python"
10561056
required: true
10571057
scope: Instance
@@ -1135,7 +1135,7 @@ providers:
11351135
groupName: Advanced
11361136
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
11371137
type: Select
1138-
values: "python,python2,python3"
1138+
values: "python,python3"
11391139
default: "python"
11401140
required: true
11411141
scope: Instance
@@ -1216,7 +1216,7 @@ providers:
12161216
groupName: Advanced
12171217
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
12181218
type: Select
1219-
values: "python,python2,python3"
1219+
values: "python,python3"
12201220
default: "python"
12211221
required: true
12221222
scope: Instance
@@ -1369,7 +1369,7 @@ providers:
13691369
groupName: Advanced
13701370
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
13711371
type: Select
1372-
values: "python,python2,python3"
1372+
values: "python,python3"
13731373
default: "python"
13741374
required: true
13751375
scope: Instance
@@ -1522,7 +1522,7 @@ providers:
15221522
groupName: Advanced
15231523
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
15241524
type: Select
1525-
values: "python,python2,python3"
1525+
values: "python,python3"
15261526
default: "python"
15271527
required: true
15281528
scope: Instance
@@ -1597,7 +1597,7 @@ providers:
15971597
groupName: Advanced
15981598
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
15991599
type: Select
1600-
values: "python,python2,python3"
1600+
values: "python,python3"
16011601
default: "python"
16021602
required: true
16031603
scope: Instance
@@ -1858,7 +1858,7 @@ providers:
18581858
groupName: Advanced
18591859
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
18601860
type: Select
1861-
values: "python,python2,python3"
1861+
values: "python,python3"
18621862
default: "python"
18631863
required: true
18641864
scope: Instance
@@ -1933,7 +1933,7 @@ providers:
19331933
groupName: Advanced
19341934
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
19351935
type: Select
1936-
values: "python,python2,python3"
1936+
values: "python,python3"
19371937
default: "python"
19381938
required: true
19391939
scope: Instance
@@ -2013,7 +2013,7 @@ providers:
20132013
groupName: Advanced
20142014
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
20152015
type: Select
2016-
values: "python,python2,python3"
2016+
values: "python,python3"
20172017
default: "python"
20182018
required: true
20192019
scope: Instance
@@ -2106,7 +2106,7 @@ providers:
21062106
groupName: Advanced
21072107
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
21082108
type: Select
2109-
values: "python,python2,python3"
2109+
values: "python,python3"
21102110
default: "python"
21112111
required: true
21122112
scope: Instance
@@ -2200,7 +2200,7 @@ providers:
22002200
groupName: Advanced
22012201
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
22022202
type: Select
2203-
values: "python,python2,python3"
2203+
values: "python,python3"
22042204
default: "python"
22052205
required: true
22062206
scope: Instance
@@ -2393,7 +2393,7 @@ providers:
23932393
groupName: Advanced
23942394
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
23952395
type: Select
2396-
values: "python,python2,python3"
2396+
values: "python,python3"
23972397
default: "python"
23982398
required: true
23992399
scope: Instance
@@ -2465,7 +2465,7 @@ providers:
24652465
groupName: Advanced
24662466
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
24672467
type: Select
2468-
values: "python,python2,python3"
2468+
values: "python,python3"
24692469
default: "python"
24702470
required: true
24712471
scope: Instance
@@ -2556,7 +2556,7 @@ providers:
25562556
groupName: Advanced
25572557
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
25582558
type: Select
2559-
values: "python,python2,python3"
2559+
values: "python,python3"
25602560
default: "python"
25612561
required: true
25622562
scope: Instance
@@ -2644,7 +2644,7 @@ providers:
26442644
groupName: Advanced
26452645
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
26462646
type: Select
2647-
values: "python,python2,python3"
2647+
values: "python,python3"
26482648
default: "python"
26492649
required: true
26502650
scope: Instance
@@ -2738,7 +2738,7 @@ providers:
27382738
groupName: Advanced
27392739
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
27402740
type: Select
2741-
values: "python,python2,python3"
2741+
values: "python,python3"
27422742
default: "python"
27432743
required: true
27442744
scope: Instance
@@ -2836,7 +2836,7 @@ providers:
28362836
groupName: Advanced
28372837
description: "This plugin is written in python. Use this to define the python interpreter that is used to execute this plugin."
28382838
type: Select
2839-
values: "python,python2,python3"
2839+
values: "python,python3"
28402840
default: "python"
28412841
required: true
28422842
scope: Instance

tox.ini

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# content of: tox.ini , put in same dir as setup.py
22
[tox]
3-
envlist = py27, py36, py37, py38, py39, mypy
3+
envlist = py36, py37, py38, py39, mypy
44

55
[gh-actions]
66
python =
7-
2.7: py27
87
3.6: py36
98
3.7: py37
109
3.8: py38, mypy

0 commit comments

Comments
 (0)