diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index 0e116a29f..7f0046231 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -6,6 +6,7 @@ Python 3: ```no-highlight # apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev +# update-alternatives --install /usr/bin/python python /usr/bin/python3 1 ``` Python 2: @@ -22,6 +23,7 @@ Python 3: # yum install -y epel-release # yum install -y gcc python34 python34-devel python34-setuptools libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel # easy_install-3.4 pip +# ln -s -f python3.4 /usr/bin/python ``` Python 2: @@ -84,6 +86,14 @@ Checking connectivity... done. Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.) +Python 3: + +```no-highlight +# pip3 install -r requirements.txt +``` + +Python 2: + ```no-highlight # pip install -r requirements.txt ``` @@ -173,7 +183,7 @@ Superuser created successfully. # Collect Static Files ```no-highlight -# ./manage.py collectstatic +# ./manage.py collectstatic --no-input You have requested to collect static files at the destination location as specified in your settings: diff --git a/docs/installation/postgresql.md b/docs/installation/postgresql.md index 39a8f05cb..543a0a2cf 100644 --- a/docs/installation/postgresql.md +++ b/docs/installation/postgresql.md @@ -5,13 +5,14 @@ NetBox requires a PostgreSQL database to store data. (Please note that MySQL is **Debian/Ubuntu** ```no-highlight -# apt-get install -y postgresql libpq-dev python-psycopg2 +# apt-get update +# apt-get install -y postgresql libpq-dev ``` **CentOS/RHEL** ```no-highlight -# yum install -y postgresql postgresql-server postgresql-devel python-psycopg2 +# yum install -y postgresql postgresql-server postgresql-devel # postgresql-setup initdb ``` diff --git a/netbox/circuits/migrations/0008_circuittermination_interface_protect_on_delete.py b/netbox/circuits/migrations/0008_circuittermination_interface_protect_on_delete.py new file mode 100644 index 000000000..14ee6686d --- /dev/null +++ b/netbox/circuits/migrations/0008_circuittermination_interface_protect_on_delete.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-04-19 17:17 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0007_circuit_add_description'), + ] + + operations = [ + migrations.AlterField( + model_name='circuittermination', + name='interface', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='circuit_termination', to='dcim.Interface'), + ), + ] diff --git a/netbox/circuits/models.py b/netbox/circuits/models.py index 5dc55d503..04d9b3e13 100644 --- a/netbox/circuits/models.py +++ b/netbox/circuits/models.py @@ -151,11 +151,13 @@ class CircuitTermination(models.Model): term_side = models.CharField(max_length=1, choices=TERM_SIDE_CHOICES, verbose_name='Termination') site = models.ForeignKey('dcim.Site', related_name='circuit_terminations', on_delete=models.PROTECT) interface = models.OneToOneField( - 'dcim.Interface', related_name='circuit_termination', blank=True, null=True, on_delete=models.CASCADE + 'dcim.Interface', related_name='circuit_termination', blank=True, null=True, on_delete=models.PROTECT ) port_speed = models.PositiveIntegerField(verbose_name='Port speed (Kbps)') - upstream_speed = models.PositiveIntegerField(blank=True, null=True, verbose_name='Upstream speed (Kbps)', - help_text='Upstream speed, if different from port speed') + upstream_speed = models.PositiveIntegerField( + blank=True, null=True, verbose_name='Upstream speed (Kbps)', + help_text='Upstream speed, if different from port speed' + ) xconnect_id = models.CharField(max_length=50, blank=True, verbose_name='Cross-connect ID') pp_info = models.CharField(max_length=100, blank=True, verbose_name='Patch panel/port(s)') diff --git a/netbox/generate_secret_key.py b/netbox/generate_secret_key.py index 0e0214dc4..3c88aa710 100755 --- a/netbox/generate_secret_key.py +++ b/netbox/generate_secret_key.py @@ -1,8 +1,7 @@ #!/usr/bin/env python # This script will generate a random 50-character string suitable for use as a SECRET_KEY. -import os import random charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)' -random.seed = (os.urandom(2048)) -print(''.join(random.choice(charset) for c in range(50))) +secure_random = random.SystemRandom() +print(''.join(secure_random.sample(charset, 50))) diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index c1b0d0c98..33cfc2211 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -418,12 +418,15 @@ class IPAddressForm(BootstrapMixin, ReturnURLForm, CustomFieldForm): self.fields['nat_inside'].choices = [] -class IPAddressBulkAddForm(BootstrapMixin, forms.Form): - address = ExpandableIPAddressField() +class IPAddressBulkAddForm(BootstrapMixin, CustomFieldForm): + address_pattern = ExpandableIPAddressField(label='Address Pattern') vrf = forms.ModelChoiceField(queryset=VRF.objects.all(), required=False, label='VRF', empty_label='Global') - tenant = forms.ModelChoiceField(queryset=Tenant.objects.all(), required=False) - status = forms.ChoiceField(choices=IPADDRESS_STATUS_CHOICES) - description = forms.CharField(max_length=100, required=False) + + pattern_map = ('address_pattern', 'address') + + class Meta: + model = IPAddress + fields = ['address_pattern', 'vrf', 'tenant', 'status', 'description'] class IPAddressAssignForm(BootstrapMixin, forms.Form): diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index ae06418ba..87d2636d8 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -588,7 +588,7 @@ class IPAddressDeleteView(PermissionRequiredMixin, ObjectDeleteView): class IPAddressBulkAddView(PermissionRequiredMixin, BulkAddView): permission_required = 'ipam.add_ipaddress' form = forms.IPAddressBulkAddForm - model = IPAddress + model_form = forms.IPAddressForm template_name = 'ipam/ipaddress_bulk_add.html' default_return_url = 'ipam:ipaddress_list' diff --git a/netbox/templates/ipam/ipaddress_bulk_add.html b/netbox/templates/ipam/ipaddress_bulk_add.html index 1599ee900..d53f73bd5 100644 --- a/netbox/templates/ipam/ipaddress_bulk_add.html +++ b/netbox/templates/ipam/ipaddress_bulk_add.html @@ -10,13 +10,21 @@ {% block form %}