diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 9af9647f0..6ee058e89 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -17,7 +17,7 @@ body: What version of NetBox are you currently running? (If you don't have access to the most recent NetBox release, consider testing on our [demo instance](https://demo.netbox.dev/) before opening a bug report to see if your issue has already been addressed.) - placeholder: v2.11.4 + placeholder: v2.11.5 validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index b6e53491e..c18fc3a1a 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -14,7 +14,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v2.11.4 + placeholder: v2.11.5 validations: required: true - type: dropdown diff --git a/docs/additional-features/reports.md b/docs/additional-features/reports.md index bac1003fd..0d75abd21 100644 --- a/docs/additional-features/reports.md +++ b/docs/additional-features/reports.md @@ -80,7 +80,7 @@ class DeviceConnectionsReport(Report): self.log_success(device) ``` -As you can see, reports are completely customizable. Validation logic can be as simple or as complex as needed. +As you can see, reports are completely customizable. Validation logic can be as simple or as complex as needed. Also note that the `description` attribute support markdown syntax. It will be rendered in the report list page. !!! warning Reports should never alter data: If you find yourself using the `create()`, `save()`, `update()`, or `delete()` methods on objects within reports, stop and re-evaluate what you're trying to accomplish. Note that there are no safeguards against the accidental alteration or destruction of data. @@ -93,7 +93,7 @@ The following methods are available to log results within a report: * log_warning(object, message) * log_failure(object, message) -The recording of one or more failure messages will automatically flag a report as failed. It is advised to log a success for each object that is evaluated so that the results will reflect how many objects are being reported on. (The inclusion of a log message is optional for successes.) Messages recorded with `log()` will appear in a report's results but are not associated with a particular object or status. +The recording of one or more failure messages will automatically flag a report as failed. It is advised to log a success for each object that is evaluated so that the results will reflect how many objects are being reported on. (The inclusion of a log message is optional for successes.) Messages recorded with `log()` will appear in a report's results but are not associated with a particular object or status. Log messages also support using markdown syntax and will be rendered on the report result page. To perform additional tasks, such as sending an email or calling a webhook, after a report has been run, extend the `post_run()` method. The status of the report is available as `self.failed` and the results object is `self.result`. diff --git a/docs/release-notes/version-2.11.md b/docs/release-notes/version-2.11.md index 43ea4d5f6..db773e2bd 100644 --- a/docs/release-notes/version-2.11.md +++ b/docs/release-notes/version-2.11.md @@ -1,12 +1,16 @@ # NetBox v2.11 -## v2.11.5 (FUTURE) +## v2.11.5 (2021-06-04) + +**NOTE:** This release includes a database migration that calculates and annotates prefix depth. It may impose a noticeable delay on the upgrade process: Users should anticipate roughly one minute of delay per 100 thousand prefixes being updated. ### Enhancements * [#6087](https://github.com/netbox-community/netbox/issues/6087) - Improved prefix hierarchy rendering * [#6487](https://github.com/netbox-community/netbox/issues/6487) - Add location filter to cable connection form * [#6501](https://github.com/netbox-community/netbox/issues/6501) - Expose prefix depth and children on REST API serializer +* [#6527](https://github.com/netbox-community/netbox/issues/6527) - Support Markdown for report descriptions +* [#6540](https://github.com/netbox-community/netbox/issues/6540) - Add a "flat" column to the prefix table ### Bug Fixes diff --git a/netbox/ipam/api/serializers.py b/netbox/ipam/api/serializers.py index 4178f6746..ff43e07b2 100644 --- a/netbox/ipam/api/serializers.py +++ b/netbox/ipam/api/serializers.py @@ -273,7 +273,7 @@ class IPAddressSerializer(PrimaryModelSerializer): ) assigned_object = serializers.SerializerMethodField(read_only=True) nat_inside = NestedIPAddressSerializer(required=False, allow_null=True) - nat_outside = NestedIPAddressSerializer(read_only=True) + nat_outside = NestedIPAddressSerializer(required=False, read_only=True) class Meta: model = IPAddress @@ -282,7 +282,7 @@ class IPAddressSerializer(PrimaryModelSerializer): 'assigned_object_id', 'assigned_object', 'nat_inside', 'nat_outside', 'dns_name', 'description', 'tags', 'custom_fields', 'created', 'last_updated', ] - read_only_fields = ['family'] + read_only_fields = ['family', 'nat_outside'] @swagger_serializer_method(serializer_or_field=serializers.DictField) def get_assigned_object(self, obj): diff --git a/netbox/ipam/migrations/0048_prefix_populate_depth_children.py b/netbox/ipam/migrations/0048_prefix_populate_depth_children.py index b1c2136b8..279f899f6 100644 --- a/netbox/ipam/migrations/0048_prefix_populate_depth_children.py +++ b/netbox/ipam/migrations/0048_prefix_populate_depth_children.py @@ -4,17 +4,6 @@ from django.db import migrations from ipam.utils import rebuild_prefixes -def push_to_stack(stack, prefix): - # Increment child count on parent nodes - for n in stack: - n['children'] += 1 - stack.append({ - 'pk': prefix['pk'], - 'prefix': prefix['prefix'], - 'children': 0, - }) - - def populate_prefix_hierarchy(apps, schema_editor): """ Populate _depth and _children attrs for all Prefixes. diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py index 7f8cb8315..1ace3a052 100644 --- a/netbox/ipam/tables.py +++ b/netbox/ipam/tables.py @@ -277,6 +277,11 @@ class PrefixTable(BaseTable): template_code=PREFIX_LINK, attrs={'td': {'class': 'text-nowrap'}} ) + prefix_flat = tables.Column( + accessor=Accessor('prefix'), + linkify=True, + verbose_name='Prefix (Flat)' + ) depth = tables.Column( accessor=Accessor('_depth'), verbose_name='Depth' @@ -318,8 +323,8 @@ class PrefixTable(BaseTable): class Meta(BaseTable.Meta): model = Prefix fields = ( - 'pk', 'prefix', 'status', 'depth', 'children', 'vrf', 'tenant', 'site', 'vlan', 'role', 'is_pool', - 'mark_utilized', 'description', + 'pk', 'prefix', 'prefix_flat', 'status', 'depth', 'children', 'vrf', 'tenant', 'site', 'vlan', 'role', + 'is_pool', 'mark_utilized', 'description', ) default_columns = ('pk', 'prefix', 'status', 'vrf', 'tenant', 'site', 'vlan', 'role', 'description') row_attrs = { @@ -332,15 +337,14 @@ class PrefixDetailTable(PrefixTable): accessor='get_utilization', orderable=False ) - tenant = TenantColumn() tags = TagColumn( url_name='ipam:prefix_list' ) class Meta(PrefixTable.Meta): fields = ( - 'pk', 'prefix', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', 'is_pool', - 'mark_utilized', 'description', 'tags', + 'pk', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', + 'is_pool', 'mark_utilized', 'description', 'tags', ) default_columns = ( 'pk', 'prefix', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', 'description', diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 6338c32df..e66e1ae24 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -16,7 +16,7 @@ from django.core.validators import URLValidator # Environment setup # -VERSION = '2.12-beta1' +VERSION = '3.0-beta1' # Hostname HOSTNAME = platform.node() diff --git a/netbox/netbox/views/generic.py b/netbox/netbox/views/generic.py index a92e8b8af..f6f153d71 100644 --- a/netbox/netbox/views/generic.py +++ b/netbox/netbox/views/generic.py @@ -774,9 +774,7 @@ class BulkEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View): # If we are editing *all* objects in the queryset, replace the PK list with all matched objects. if request.POST.get('_all') and self.filterset is not None: - pk_list = [ - obj.pk for obj in self.filterset(request.GET, self.queryset.only('pk')).qs - ] + pk_list = self.filterset(request.GET, self.queryset.values_list('pk', flat=True)).qs else: pk_list = request.POST.getlist('pk') diff --git a/netbox/templates/extras/report.html b/netbox/templates/extras/report.html index e914e2776..acbd08e77 100644 --- a/netbox/templates/extras/report.html +++ b/netbox/templates/extras/report.html @@ -11,7 +11,7 @@ {% block content %} {% if report.description %} -
{{ report.description }}
+{{ report.description|render_markdown }}
{% endif %} {% if perms.extras.run_report %}