diff --git a/docs/getting-started.md b/docs/getting-started.md index 1d657fbf3..8f2688aef 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -259,10 +259,10 @@ Restart the nginx service to use the new 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' bind = '127.0.0.1:8001' workers = 3 diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 0fe3bc30c..5ff233c9c 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -183,6 +183,16 @@ class Rack(CreatedUpdatedModel): def get_absolute_url(self): 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): return ','.join([ self.site.name, diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index fd4aaf6ff..50c3243d8 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -353,7 +353,7 @@ class ComponentTemplateCreateView(View): if not form.errors: 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: return redirect(request.path) else: diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 7ad41697e..260365eec 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -19,11 +19,11 @@ def expand_pattern(string): lead, pattern, remnant = re.split(EXPANSION_PATTERN, string, maxsplit=1) x, y = pattern.split('-') for i in range(int(x), int(y) + 1): - if remnant: + if re.search(EXPANSION_PATTERN, remnant): for string in expand_pattern(remnant): yield "{}{}{}".format(lead, i, string) else: - yield "{}{}".format(lead, i) + yield "{}{}{}".format(lead, i, remnant) #