Merge pull request #31 from digitalocean/develop

Release 1.0.2
This commit is contained in:
Jeremy Stretch 2016-06-27 14:53:27 -04:00 committed by GitHub
commit 0b37d4f5e6
4 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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,

View File

@ -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:

View File

@ -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)
#