Rack groups have been renamed to locations
This commit is contained in:
parent
9ab202f921
commit
5944086435
|
@ -2,4 +2,4 @@
|
|||
# site: AMS 1
|
||||
# - name: power panel SING 1
|
||||
# site: SING 1
|
||||
# rack_group: cage 101
|
||||
# location: cage 101
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
# text_field: Description
|
||||
# - site: SING 1
|
||||
# name: rack-03
|
||||
# group: cage 101
|
||||
# location: cage 101
|
||||
# role: Role 3
|
||||
# type: 4-post-cabinet
|
||||
# width: 19
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import sys
|
||||
|
||||
from dcim.models import RackGroup, Site
|
||||
from dcim.models import Location, Site
|
||||
from startup_script_utils import load_yaml
|
||||
|
||||
rack_groups = load_yaml("/opt/netbox/initializers/rack_groups.yml")
|
||||
rack_groups = load_yaml("/opt/netbox/initializers/locations.yml")
|
||||
|
||||
if rack_groups is None:
|
||||
sys.exit()
|
||||
|
@ -17,7 +17,7 @@ for params in rack_groups:
|
|||
query = {field: params.pop(assoc)}
|
||||
params[assoc] = model.objects.get(**query)
|
||||
|
||||
rack_group, created = RackGroup.objects.get_or_create(**params)
|
||||
location, created = Location.objects.get_or_create(**params)
|
||||
|
||||
if created:
|
||||
print("🎨 Created rack group", rack_group.name)
|
||||
print("🎨 Created location", location.name)
|
|
@ -1,6 +1,6 @@
|
|||
import sys
|
||||
|
||||
from dcim.models import Rack, RackGroup, RackRole, Site
|
||||
from dcim.models import Rack, Location, RackRole, Site
|
||||
from startup_script_utils import load_yaml, pop_custom_fields, set_custom_fields_values
|
||||
from tenancy.models import Tenant
|
||||
|
||||
|
@ -14,7 +14,7 @@ required_assocs = {"site": (Site, "name")}
|
|||
optional_assocs = {
|
||||
"role": (RackRole, "name"),
|
||||
"tenant": (Tenant, "name"),
|
||||
"group": (RackGroup, "name"),
|
||||
"location": (Location, "name"),
|
||||
}
|
||||
|
||||
for params in racks:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import sys
|
||||
|
||||
from dcim.models import PowerPanel, RackGroup, Site
|
||||
from dcim.models import PowerPanel, Location, Site
|
||||
from startup_script_utils import load_yaml, pop_custom_fields, set_custom_fields_values
|
||||
|
||||
power_panels = load_yaml("/opt/netbox/initializers/power_panels.yml")
|
||||
|
@ -10,7 +10,7 @@ if power_panels is None:
|
|||
|
||||
required_assocs = {"site": (Site, "name")}
|
||||
|
||||
optional_assocs = {"rack_group": (RackGroup, "name")}
|
||||
optional_assocs = {"location": (Location, "name")}
|
||||
|
||||
for params in power_panels:
|
||||
custom_field_data = pop_custom_fields(params)
|
||||
|
|
Loading…
Reference in New Issue