Skip to content

Commit 9093f65

Browse files
authored
Merge pull request #130 from tobiasge/netbox-4.6
Prepare for Netbox 4.6
2 parents d649ab1 + bdf4a43 commit 9093f65

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Load data from YAML files into Netbox
77
First activate your virtual environment where Netbox is installed, the install the plugin version corresponding to your Netbox version.
88

99
```bash
10-
pip install "netbox-initializers==4.5.*"
10+
pip install "netbox-initializers==4.6.*"
1111
```
1212

1313
Then you need to add the plugin to the `PLUGINS` array in the Netbox configuration.
@@ -38,6 +38,6 @@ The initializers where a part of the Docker image and where then extracted into
3838
To use the new plugin in a the Netbox Docker image, it musst be installad into the image. To this, the following example can be used as a starting point:
3939

4040
```dockerfile
41-
FROM netboxcommunity/netbox:v4.5
42-
RUN /usr/local/bin/uv pip install "netbox-initializers==4.5.*"
41+
FROM netboxcommunity/netbox:v4.6
42+
RUN /usr/local/bin/uv pip install "netbox-initializers==4.6.*"
4343
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dev = ["ruff==0.15.12"]
3232

3333
[tool.ruff]
3434
line-length = 100
35-
target-version = "py311"
35+
target-version = "py312"
3636

3737
[tool.ruff.lint]
3838
extend-select = ["I", "PL", "W191", "W291", "W292", "W293"]

src/netbox_initializers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class NetBoxInitializersConfig(PluginConfig):
99
description = "Load initial data into Netbox"
1010
version = VERSION
1111
base_url = "initializers"
12-
min_version = "4.5.0"
13-
max_version = "4.5.99"
12+
min_version = "4.6.0"
13+
max_version = "4.6.99"
1414

1515

1616
config = NetBoxInitializersConfig

src/netbox_initializers/initializers/device_roles.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from dcim.models import DeviceRole
2-
from netbox.choices import ColorChoices
32
from django.core.exceptions import ObjectDoesNotExist
3+
from netbox.choices import ColorChoices
44

55
from netbox_initializers.initializers.base import BaseInitializer, register_initializer
66

@@ -27,7 +27,9 @@ def load_data(self):
2727
try:
2828
parent_obj = DeviceRole.objects.get(name=parent_value)
2929
except ObjectDoesNotExist:
30-
raise ValueError(f"DeviceRole parent '{parent_value}' not found by slug or name")
30+
raise ValueError(
31+
f"DeviceRole parent '{parent_value}' not found by slug or name"
32+
)
3133

3234
if parent_obj:
3335
params["parent"] = parent_obj
@@ -40,7 +42,9 @@ def load_data(self):
4042
params["color"] = color_tpl[0]
4143

4244
matching_params, defaults = self.split_params(params)
43-
device_role, created = DeviceRole.objects.get_or_create(**matching_params, defaults=defaults)
45+
device_role, created = DeviceRole.objects.get_or_create(
46+
**matching_params, defaults=defaults
47+
)
4448

4549
if created:
4650
print("🎨 Created device role", device_role.name)

src/netbox_initializers/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "4.5.1"
1+
VERSION = "4.6.0"

test/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM netboxcommunity/netbox:v4.5
1+
FROM netboxcommunity/netbox:v4.6
22

33
COPY ../ /opt/netbox-initializers/
44
COPY ./test/config/plugins.py /etc/netbox/config/

0 commit comments

Comments
 (0)