Skip to content

Commit b184da0

Browse files
authored
Merge pull request #193 from SaaShup/add_container_command
✨ Add Container command
2 parents b7eac2d + 233d1d7 commit b184da0

File tree

13 files changed

+53
-4
lines changed

13 files changed

+53
-4
lines changed

.github/workflows/main_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
max-parallel: 4
1313
matrix:
1414
python-version: ["3.12"]
15-
netbox-version: ["v4.2.8"]
15+
netbox-version: ["v4.3.1"]
1616
services:
1717
redis:
1818
image: redis

.github/workflows/pr_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
max-parallel: 4
1616
matrix:
1717
python-version: ["3.12"]
18-
netbox-version: ["v4.2.8"]
18+
netbox-version: ["v4.3.1"]
1919
services:
2020
redis:
2121
image: redis

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Below the compatibility list of the Netbox Docker PLugin and Netbox. Please chos
4444
| 4.0.\* | 2.\* |
4545
| 4.1.\* | 3.\* |
4646
| 4.2.\* | 4.\* |
47+
| 4.3.\* | 4.\* |
4748

4849
You can follow [the official plugins installation
4950
instructions](https://docs.netbox.dev/en/stable/plugins/#installing-plugins).

netbox_docker_plugin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class NetBoxDockerConfig(PluginConfig):
1111
name = "netbox_docker_plugin"
1212
verbose_name = " NetBox Docker Plugin"
1313
description = "Manage Docker"
14-
version = "4.0.1"
14+
version = "4.2.0"
1515
base_url = "docker"
1616
min_version = "4.2.0"
1717
author = "Vincent Simonin <vincent@saashup.com>, David Delassus <david.jose.delassus@gmail.com>"

netbox_docker_plugin/api/serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class Meta:
166166
"hostname",
167167
"cap_add",
168168
"log_driver",
169+
"cmd",
169170
)
170171

171172

@@ -456,6 +457,7 @@ class Meta:
456457
"hostname",
457458
"restart_policy",
458459
"cap_add",
460+
"cmd",
459461
"ports",
460462
"env",
461463
"labels",

netbox_docker_plugin/forms/container.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Meta:
4949
"restart_policy",
5050
"cap_add",
5151
"log_driver",
52+
"cmd",
5253
"tags",
5354
)
5455
labels = {
@@ -59,6 +60,7 @@ class Meta:
5960
"restart_policy": "Restart Policy",
6061
"cap_add": "Add Host capabilities",
6162
"log_driver": "Logging driver",
63+
"cmd": "Command",
6264
}
6365

6466

@@ -84,6 +86,7 @@ class Meta:
8486
"restart_policy",
8587
"cap_add",
8688
"log_driver",
89+
"cmd",
8790
"tags",
8891
)
8992
labels = {
@@ -93,6 +96,7 @@ class Meta:
9396
"restart_policy": "Restart Policy",
9497
"cap_add": "Add Host capabilities",
9598
"log_driver": "Logging driver",
99+
"cmd": "Command",
96100
}
97101

98102

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# pylint: disable=C0103
2+
"""Migration file"""
3+
4+
import django.contrib.postgres.fields
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
"""Migration file"""
10+
11+
dependencies = [
12+
("netbox_docker_plugin", "0037_alter_env_value"),
13+
]
14+
15+
operations = [
16+
migrations.AddField(
17+
model_name="container",
18+
name="cmd",
19+
field=django.contrib.postgres.fields.ArrayField(
20+
base_field=models.CharField(blank=True, max_length=1024, null=True),
21+
blank=True,
22+
null=True,
23+
size=None,
24+
),
25+
),
26+
]

netbox_docker_plugin/models/container.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ class Container(NetBoxModel):
159159
max_length=32,
160160
default=DEFAULT_LOG_DRIVER,
161161
)
162+
cmd = ArrayField(
163+
models.CharField(
164+
max_length=1024, blank=True, null=True
165+
),
166+
null=True,
167+
blank=True,
168+
)
162169

163170
@property
164171
def can_create(self) -> bool:

netbox_docker_plugin/tables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ class Meta(NetBoxTable.Meta):
283283
"hostname",
284284
"restart_policy",
285285
"cap_add",
286+
"cmd",
286287
"port_count",
287288
"mount_count",
288289
"bind_count",

netbox_docker_plugin/templates/netbox_docker_plugin/container.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ <h5 class="card-header">CONTAINER</h5>
5353
<th scope="row">Logging driver</th>
5454
<td>{{ object.log_driver }}</td>
5555
</tr>
56+
<tr>
57+
<th scope="row">Command</th>
58+
<td>{{ object.cmd }}</td>
59+
</tr>
5660
</table>
5761
</div>
5862
</div>

0 commit comments

Comments
 (0)