mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge branch 'develop' into develop-2.7
This commit is contained in:
0
.github/stale.yaml → .github/stale.yml
vendored
0
.github/stale.yaml → .github/stale.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
# v2.6.8 (FUTURE)
|
# v2.6.8 (2019-12-10)
|
||||||
|
|
||||||
## Enhancements
|
## Enhancements
|
||||||
|
|
||||||
@ -6,12 +6,21 @@
|
|||||||
* [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view
|
* [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view
|
||||||
* [#3329](https://github.com/netbox-community/netbox/issues/3329) - Remove obsolete P3P policy header
|
* [#3329](https://github.com/netbox-community/netbox/issues/3329) - Remove obsolete P3P policy header
|
||||||
* [#3663](https://github.com/netbox-community/netbox/issues/3663) - Add query filters for `created` and `last_updated` fields
|
* [#3663](https://github.com/netbox-community/netbox/issues/3663) - Add query filters for `created` and `last_updated` fields
|
||||||
|
* [#3722](https://github.com/netbox-community/netbox/issues/3722) - Allow the underscore character in IPAddress DNS names
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
|
* [#3312](https://github.com/netbox-community/netbox/issues/3312) - Fix validation error when editing power cables in bulk
|
||||||
|
* [#3644](https://github.com/netbox-community/netbox/issues/3644) - Fix exception when connecting a cable to a RearPort with no corresponding FrontPort
|
||||||
* [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form
|
* [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form
|
||||||
* [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view
|
* [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view
|
||||||
* [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page
|
* [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page
|
||||||
|
* [#3709](https://github.com/netbox-community/netbox/issues/3709) - Prevent exception when importing an invalid cable definition
|
||||||
|
* [#3720](https://github.com/netbox-community/netbox/issues/3720) - Correctly indicate power feed terminations on cable list
|
||||||
|
* [#3724](https://github.com/netbox-community/netbox/issues/3724) - Fix API filtering of interfaces by more than one device name
|
||||||
|
* [#3725](https://github.com/netbox-community/netbox/issues/3725) - Enforce client validation for minimum service port number
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# v2.6.7 (2019-11-01)
|
# v2.6.7 (2019-11-01)
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ pages:
|
|||||||
- Change Logging: 'additional-features/change-logging.md'
|
- Change Logging: 'additional-features/change-logging.md'
|
||||||
- Context Data: 'additional-features/context-data.md'
|
- Context Data: 'additional-features/context-data.md'
|
||||||
- Custom Fields: 'additional-features/custom-fields.md'
|
- Custom Fields: 'additional-features/custom-fields.md'
|
||||||
|
- Custom Links: 'additional-features/custom-links.md'
|
||||||
- Custom Scripts: 'additional-features/custom-scripts.md'
|
- Custom Scripts: 'additional-features/custom-scripts.md'
|
||||||
- Export Templates: 'additional-features/export-templates.md'
|
- Export Templates: 'additional-features/export-templates.md'
|
||||||
- Graphs: 'additional-features/graphs.md'
|
- Graphs: 'additional-features/graphs.md'
|
||||||
|
@ -31,7 +31,7 @@ CONNECTION_STATUS_CHOICES = [
|
|||||||
# Cable endpoint types
|
# Cable endpoint types
|
||||||
CABLE_TERMINATION_TYPES = [
|
CABLE_TERMINATION_TYPES = [
|
||||||
'consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport',
|
'consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport',
|
||||||
'circuittermination',
|
'circuittermination', 'powerfeed',
|
||||||
]
|
]
|
||||||
|
|
||||||
CABLE_TERMINATION_TYPE_CHOICES = {
|
CABLE_TERMINATION_TYPE_CHOICES = {
|
||||||
|
@ -7,8 +7,8 @@ from tenancy.filtersets import TenancyFilterSet
|
|||||||
from tenancy.models import Tenant
|
from tenancy.models import Tenant
|
||||||
from utilities.constants import COLOR_CHOICES
|
from utilities.constants import COLOR_CHOICES
|
||||||
from utilities.filters import (
|
from utilities.filters import (
|
||||||
MultiValueMACAddressFilter, MultiValueNumberFilter, NameSlugSearchFilterSet, NumericInFilter, TagFilter,
|
MultiValueCharFilter, MultiValueMACAddressFilter, MultiValueNumberFilter, NameSlugSearchFilterSet, NumericInFilter,
|
||||||
TreeNodeMultipleChoiceFilter,
|
TagFilter, TreeNodeMultipleChoiceFilter,
|
||||||
)
|
)
|
||||||
from virtualization.models import Cluster
|
from virtualization.models import Cluster
|
||||||
from .choices import *
|
from .choices import *
|
||||||
@ -754,7 +754,7 @@ class InterfaceFilter(django_filters.FilterSet):
|
|||||||
queryset=Site.objects.all(),
|
queryset=Site.objects.all(),
|
||||||
label='Site name (slug)',
|
label='Site name (slug)',
|
||||||
)
|
)
|
||||||
device = django_filters.CharFilter(
|
device = MultiValueCharFilter(
|
||||||
method='filter_device',
|
method='filter_device',
|
||||||
field_name='name',
|
field_name='name',
|
||||||
label='Device',
|
label='Device',
|
||||||
@ -807,8 +807,10 @@ class InterfaceFilter(django_filters.FilterSet):
|
|||||||
|
|
||||||
def filter_device(self, queryset, name, value):
|
def filter_device(self, queryset, name, value):
|
||||||
try:
|
try:
|
||||||
device = Device.objects.get(**{name: value})
|
devices = Device.objects.filter(**{'{}__in'.format(name): value})
|
||||||
vc_interface_ids = device.vc_interfaces.values_list('id', flat=True)
|
vc_interface_ids = []
|
||||||
|
for device in devices:
|
||||||
|
vc_interface_ids.extend(device.vc_interfaces.values_list('id', flat=True))
|
||||||
return queryset.filter(pk__in=vc_interface_ids)
|
return queryset.filter(pk__in=vc_interface_ids)
|
||||||
except Device.DoesNotExist:
|
except Device.DoesNotExist:
|
||||||
return queryset.none()
|
return queryset.none()
|
||||||
|
@ -174,8 +174,8 @@ class Migration(migrations.Migration):
|
|||||||
('length', models.PositiveSmallIntegerField(blank=True, null=True)),
|
('length', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||||
('length_unit', models.PositiveSmallIntegerField(blank=True, null=True)),
|
('length_unit', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||||
('_abs_length', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)),
|
('_abs_length', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)),
|
||||||
('termination_a_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')),
|
('termination_a_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination', 'powerfeed']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')),
|
||||||
('termination_b_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')),
|
('termination_b_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination', 'powerfeed']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.AlterUniqueTogether(
|
migrations.AlterUniqueTogether(
|
||||||
|
@ -82,7 +82,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='cable',
|
model_name='cable',
|
||||||
name='status',
|
name='status',
|
||||||
field=models.CharField(max_length=50),
|
field=models.CharField(default='connected', max_length=50),
|
||||||
),
|
),
|
||||||
migrations.RunPython(
|
migrations.RunPython(
|
||||||
code=cable_status_to_slug
|
code=cable_status_to_slug
|
||||||
|
@ -99,6 +99,8 @@ class CableTermination(models.Model):
|
|||||||
object_id_field='termination_b_id'
|
object_id_field='termination_b_id'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_path_endpoint = True
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@ -2517,6 +2519,8 @@ class FrontPort(CableTermination, ComponentModel):
|
|||||||
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_path_endpoint = False
|
||||||
|
|
||||||
objects = NaturalOrderingManager()
|
objects = NaturalOrderingManager()
|
||||||
tags = TaggableManager(through=TaggedItem)
|
tags = TaggableManager(through=TaggedItem)
|
||||||
|
|
||||||
@ -2580,6 +2584,8 @@ class RearPort(CableTermination, ComponentModel):
|
|||||||
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
validators=[MinValueValidator(1), MaxValueValidator(64)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_path_endpoint = False
|
||||||
|
|
||||||
objects = NaturalOrderingManager()
|
objects = NaturalOrderingManager()
|
||||||
tags = TaggableManager(through=TaggedItem)
|
tags = TaggableManager(through=TaggedItem)
|
||||||
|
|
||||||
@ -2913,6 +2919,8 @@ class Cable(ChangeLoggedModel):
|
|||||||
def clean(self):
|
def clean(self):
|
||||||
|
|
||||||
# Validate that termination A exists
|
# Validate that termination A exists
|
||||||
|
if not hasattr(self, 'termination_a_type'):
|
||||||
|
raise ValidationError('Termination A type has not been specified')
|
||||||
try:
|
try:
|
||||||
self.termination_a_type.model_class().objects.get(pk=self.termination_a_id)
|
self.termination_a_type.model_class().objects.get(pk=self.termination_a_id)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
@ -2921,6 +2929,8 @@ class Cable(ChangeLoggedModel):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Validate that termination B exists
|
# Validate that termination B exists
|
||||||
|
if not hasattr(self, 'termination_b_type'):
|
||||||
|
raise ValidationError('Termination B type has not been specified')
|
||||||
try:
|
try:
|
||||||
self.termination_b_type.model_class().objects.get(pk=self.termination_b_id)
|
self.termination_b_type.model_class().objects.get(pk=self.termination_b_id)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
|
@ -45,7 +45,7 @@ def update_connected_endpoints(instance, **kwargs):
|
|||||||
|
|
||||||
# Check if this Cable has formed a complete path. If so, update both endpoints.
|
# Check if this Cable has formed a complete path. If so, update both endpoints.
|
||||||
endpoint_a, endpoint_b, path_status = instance.get_path_endpoints()
|
endpoint_a, endpoint_b, path_status = instance.get_path_endpoints()
|
||||||
if endpoint_a is not None and endpoint_b is not None:
|
if getattr(endpoint_a, 'is_path_endpoint', False) and getattr(endpoint_b, 'is_path_endpoint', False):
|
||||||
endpoint_a.connected_endpoint = endpoint_b
|
endpoint_a.connected_endpoint = endpoint_b
|
||||||
endpoint_a.connection_status = path_status
|
endpoint_a.connection_status = path_status
|
||||||
endpoint_a.save()
|
endpoint_a.save()
|
||||||
|
@ -177,8 +177,10 @@ VIRTUALCHASSIS_ACTIONS = """
|
|||||||
CABLE_TERMINATION_PARENT = """
|
CABLE_TERMINATION_PARENT = """
|
||||||
{% if value.device %}
|
{% if value.device %}
|
||||||
<a href="{{ value.device.get_absolute_url }}">{{ value.device }}</a>
|
<a href="{{ value.device.get_absolute_url }}">{{ value.device }}</a>
|
||||||
{% else %}
|
{% elif value.circuit %}
|
||||||
<a href="{{ value.circuit.get_absolute_url }}">{{ value.circuit }}</a>
|
<a href="{{ value.circuit.get_absolute_url }}">{{ value.circuit }}</a>
|
||||||
|
{% elif value.power_panel %}
|
||||||
|
<a href="{{ value.power_panel.get_absolute_url }}">{{ value.power_panel }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -855,7 +857,7 @@ class CableTable(BaseTable):
|
|||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Termination A'
|
verbose_name='Termination A'
|
||||||
)
|
)
|
||||||
termination_a = tables.Column(
|
termination_a = tables.LinkColumn(
|
||||||
accessor=Accessor('termination_a'),
|
accessor=Accessor('termination_a'),
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name=''
|
verbose_name=''
|
||||||
@ -866,7 +868,7 @@ class CableTable(BaseTable):
|
|||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Termination B'
|
verbose_name='Termination B'
|
||||||
)
|
)
|
||||||
termination_b = tables.Column(
|
termination_b = tables.LinkColumn(
|
||||||
accessor=Accessor('termination_b'),
|
accessor=Accessor('termination_b'),
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name=''
|
verbose_name=''
|
||||||
|
@ -1250,6 +1250,10 @@ class VLANFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldFilterForm):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class ServiceForm(BootstrapMixin, CustomFieldForm):
|
class ServiceForm(BootstrapMixin, CustomFieldForm):
|
||||||
|
port = forms.IntegerField(
|
||||||
|
min_value=1,
|
||||||
|
max_value=65535
|
||||||
|
)
|
||||||
tags = TagField(
|
tags = TagField(
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,6 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ipaddress',
|
model_name='ipaddress',
|
||||||
name='dns_name',
|
name='dns_name',
|
||||||
field=models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, hyphens, and periods are allowed in DNS names', regex='^[0-9A-Za-z.-]+$')]),
|
field=models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names', regex='^[0-9A-Za-z._-]+$')]),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,7 @@ from django.core.validators import RegexValidator
|
|||||||
|
|
||||||
|
|
||||||
DNSValidator = RegexValidator(
|
DNSValidator = RegexValidator(
|
||||||
regex='^[0-9A-Za-z.-]+$',
|
regex='^[0-9A-Za-z._-]+$',
|
||||||
message='Only alphanumeric characters, hyphens, and periods are allowed in DNS names',
|
message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names',
|
||||||
code='invalid'
|
code='invalid'
|
||||||
)
|
)
|
||||||
|
@ -9,6 +9,24 @@
|
|||||||
|
|
||||||
exec 1>&2
|
exec 1>&2
|
||||||
|
|
||||||
|
EXIT=0
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NOCOLOR='\033[0m'
|
||||||
|
|
||||||
echo "Validating PEP8 compliance..."
|
echo "Validating PEP8 compliance..."
|
||||||
pycodestyle --ignore=W504,E501 netbox/
|
pycodestyle --ignore=W504,E501 netbox/
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
EXIT=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Checking for missing migrations..."
|
||||||
|
python netbox/manage.py makemigrations --dry-run --check
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
EXIT=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $EXIT != 0 ]; then
|
||||||
|
printf "${RED}COMMIT FAILED${NOCOLOR}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $EXIT
|
||||||
|
Reference in New Issue
Block a user