mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
commit
0b37d4f5e6
@ -259,10 +259,10 @@ Restart the nginx service to use the new configuration.
|
|||||||
|
|
||||||
## gunicorn Configuration
|
## gunicorn Configuration
|
||||||
|
|
||||||
Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`.) as `gunicorn_config.py`. Be sure to update the `pythonpath` variable if needed.
|
Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`.) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed.
|
||||||
|
|
||||||
```
|
```
|
||||||
command = '/usr/local/bin/gunicorn'
|
command = '/usr/bin/gunicorn'
|
||||||
pythonpath = '/opt/netbox/netbox'
|
pythonpath = '/opt/netbox/netbox'
|
||||||
bind = '127.0.0.1:8001'
|
bind = '127.0.0.1:8001'
|
||||||
workers = 3
|
workers = 3
|
||||||
|
@ -183,6 +183,16 @@ class Rack(CreatedUpdatedModel):
|
|||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('dcim:rack', args=[self.pk])
|
return reverse('dcim:rack', args=[self.pk])
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
|
||||||
|
# Validate that Rack is tall enough to house the installed Devices
|
||||||
|
if self.pk:
|
||||||
|
top_device = Device.objects.filter(rack=self).order_by('-position').first()
|
||||||
|
min_height = top_device.position + top_device.device_type.u_height - 1
|
||||||
|
if self.u_height < min_height:
|
||||||
|
raise ValidationError("Rack must be at least {}U tall with currently installed devices."
|
||||||
|
.format(min_height))
|
||||||
|
|
||||||
def to_csv(self):
|
def to_csv(self):
|
||||||
return ','.join([
|
return ','.join([
|
||||||
self.site.name,
|
self.site.name,
|
||||||
|
@ -353,7 +353,7 @@ class ComponentTemplateCreateView(View):
|
|||||||
|
|
||||||
if not form.errors:
|
if not form.errors:
|
||||||
self.model.objects.bulk_create(component_templates)
|
self.model.objects.bulk_create(component_templates)
|
||||||
messages.success(request, "Added {} compontent(s) to {}".format(len(component_templates), devicetype))
|
messages.success(request, "Added {} component(s) to {}".format(len(component_templates), devicetype))
|
||||||
if '_addanother' in request.POST:
|
if '_addanother' in request.POST:
|
||||||
return redirect(request.path)
|
return redirect(request.path)
|
||||||
else:
|
else:
|
||||||
|
@ -19,11 +19,11 @@ def expand_pattern(string):
|
|||||||
lead, pattern, remnant = re.split(EXPANSION_PATTERN, string, maxsplit=1)
|
lead, pattern, remnant = re.split(EXPANSION_PATTERN, string, maxsplit=1)
|
||||||
x, y = pattern.split('-')
|
x, y = pattern.split('-')
|
||||||
for i in range(int(x), int(y) + 1):
|
for i in range(int(x), int(y) + 1):
|
||||||
if remnant:
|
if re.search(EXPANSION_PATTERN, remnant):
|
||||||
for string in expand_pattern(remnant):
|
for string in expand_pattern(remnant):
|
||||||
yield "{}{}{}".format(lead, i, string)
|
yield "{}{}{}".format(lead, i, string)
|
||||||
else:
|
else:
|
||||||
yield "{}{}".format(lead, i)
|
yield "{}{}{}".format(lead, i, remnant)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user