Skip to content

Commit c7df608

Browse files
authored
Merge pull request #485 from tobiasge/prepare-2.11
Initializer updates for Netbox 2.11
2 parents eee07f7 + 752f592 commit c7df608

File tree

13 files changed

+64
-73
lines changed

13 files changed

+64
-73
lines changed

.github/workflows/push.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
name: Checks syntax of our code
1515
steps:
1616
- uses: actions/checkout@v2
17+
with:
18+
# Full git history is needed to get a proper list of changed files within `super-linter`
19+
fetch-depth: 0
1720
- uses: actions/setup-python@v2
1821
- name: Lint Code Base
1922
uses: github/super-linter@v3

initializers/custom_links.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
## Examples:
1111

1212
# - name: link_to_repo
13-
# text: 'Link to Netbox Docker'
14-
# url: 'https://github.com/netbox-community/netbox-docker'
13+
# link_text: 'Link to Netbox Docker'
14+
# link_url: 'https://github.com/netbox-community/netbox-docker'
1515
# new_window: False
1616
# content_type: device
1717
# - name: link_to_localhost
18-
# text: 'Link to localhost'
19-
# url: 'http://localhost'
18+
# link_text: 'Link to localhost'
19+
# link_url: 'http://localhost'
2020
# new_window: True
2121
# content_type: device

initializers/devices.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,12 @@
4242
# position: 3
4343
# custom_field_data:
4444
# text_field: Description
45+
# - name: server04
46+
# device_role: server
47+
# device_type: Other
48+
# site: SING 1
49+
# location: cage 101
50+
# face: front
51+
# position: 3
52+
# custom_field_data:
53+
# text_field: Description
File renamed without changes.

initializers/power_panels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# site: AMS 1
33
# - name: power panel SING 1
44
# site: SING 1
5-
# rack_group: cage 101
5+
# location: cage 101

initializers/racks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# text_field: Description
3333
# - site: SING 1
3434
# name: rack-03
35-
# group: cage 101
35+
# location: cage 101
3636
# role: Role 3
3737
# type: 4-post-cabinet
3838
# width: 19

initializers/vlan_groups.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# - name: VLAN group 1
2-
# site: AMS 1
2+
# scope_type: dcim.region
3+
# scope: Amsterdam
34
# slug: vlan-group-1
45
# - name: VLAN group 2
5-
# site: AMS 1
6+
# scope_type: dcim.site
7+
# scope: AMS 1
68
# slug: vlan-group-2
9+
# - name: VLAN group 3
10+
# scope_type: dcim.location
11+
# scope: cage 101
12+
# slug: vlan-group-3
13+
# - name: VLAN group 4
14+
# scope_type: dcim.rack
15+
# scope: rack-01
16+
# slug: vlan-group-4
17+
# - name: VLAN group 5
18+
# scope_type: virtualization.cluster
19+
# scope: cluster1
20+
# slug: vlan-group-5
21+
# - name: VLAN group 6
22+
# scope_type: virtualization.clustergroup
23+
# scope: Group 1
24+
# slug: vlan-group-6

startup_scripts/075_rack_groups.py renamed to startup_scripts/075_locations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import sys
22

3-
from dcim.models import RackGroup, Site
3+
from dcim.models import Location, Site
44
from startup_script_utils import load_yaml
55

6-
rack_groups = load_yaml("/opt/netbox/initializers/rack_groups.yml")
6+
rack_groups = load_yaml("/opt/netbox/initializers/locations.yml")
77

88
if rack_groups is None:
99
sys.exit()
@@ -17,7 +17,7 @@
1717
query = {field: params.pop(assoc)}
1818
params[assoc] = model.objects.get(**query)
1919

20-
rack_group, created = RackGroup.objects.get_or_create(**params)
20+
location, created = Location.objects.get_or_create(**params)
2121

2222
if created:
23-
print("🎨 Created rack group", rack_group.name)
23+
print("🎨 Created location", location.name)

startup_scripts/080_racks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from dcim.models import Rack, RackGroup, RackRole, Site
3+
from dcim.models import Location, Rack, RackRole, Site
44
from startup_script_utils import load_yaml, pop_custom_fields, set_custom_fields_values
55
from tenancy.models import Tenant
66

@@ -14,7 +14,7 @@
1414
optional_assocs = {
1515
"role": (RackRole, "name"),
1616
"tenant": (Tenant, "name"),
17-
"group": (RackGroup, "name"),
17+
"location": (Location, "name"),
1818
}
1919

2020
for params in racks:

startup_scripts/140_devices.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from dcim.models import Device, DeviceRole, DeviceType, Platform, Rack, Site
3+
from dcim.models import Device, DeviceRole, DeviceType, Location, Platform, Rack, Site
44
from startup_script_utils import load_yaml, pop_custom_fields, set_custom_fields_values
55
from tenancy.models import Tenant
66
from virtualization.models import Cluster
@@ -21,6 +21,7 @@
2121
"platform": (Platform, "name"),
2222
"rack": (Rack, "name"),
2323
"cluster": (Cluster, "name"),
24+
"location": (Location, "name"),
2425
}
2526

2627
for params in devices:

0 commit comments

Comments
 (0)