Skip to content

Commit a371c08

Browse files
committed
Merge branch 'develop' into develop-2.10
2 parents 43d7d55 + 55e8d37 commit a371c08

File tree

12 files changed

+101
-31
lines changed

12 files changed

+101
-31
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ about: Report a reproducible bug in the current release of NetBox
77
<!--
88
NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED.
99
10-
This form is only for reproducible bugs. If you need assistance with
11-
NetBox installation, or if you have a general question, DO NOT open an
12-
issue. Instead, post to our mailing list:
13-
14-
https://groups.google.com/g/netbox-discuss
10+
This form is only for reporting reproducible bugs. If you need assistance
11+
with NetBox installation, or if you have a general question, please start a
12+
discussion instead: https://github.com/netbox-community/netbox/discussions
1513
1614
Please describe the environment in which you are running NetBox. Be sure
1715
that you are running an unmodified instance of the latest stable release

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ about: Propose a new NetBox feature or enhancement
88
NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED.
99
1010
This form is only for proposing specific new features or enhancements.
11-
If you have a general idea or question, please post to our mailing list
12-
instead of opening an issue:
13-
14-
https://groups.google.com/g/netbox-discuss
11+
If you have a general idea or question, please start a discussion instead:
12+
https://github.com/netbox-community/netbox/discussions
1513
1614
NOTE: Due to an excessive backlog of feature requests, we are not currently
1715
accepting any proposals which significantly extend NetBox's feature scope.

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,21 @@ or join us in the **#netbox** Slack channel on [NetworkToCode](https://networkto
3737
## Installation
3838

3939
Please see [the documentation](http://netbox.readthedocs.io/en/stable/) for
40-
instructions on installing NetBox. To upgrade NetBox, please download the [latest release](https://github.com/netbox-community/netbox/releases)
41-
and run `upgrade.sh`.
40+
instructions on installing NetBox. To upgrade NetBox, please download the
41+
[latest release](https://github.com/netbox-community/netbox/releases) and
42+
run `upgrade.sh`.
4243

4344
## Providing Feedback
4445

45-
Feature requests and bug reports must be submitted as GiHub issues. (Please be
46-
sure to use the [appropriate template](https://github.com/netbox-community/netbox/issues/new/choose).)
47-
For general discussion, please consider joining our [mailing list](https://groups.google.com/g/netbox-discuss).
46+
The best platform for general feedback, assistance, and other discussion is our
47+
[GitHub discussions](https://github.com/netbox-community/netbox/discussions).
48+
To report a bug or request a specific feature, please open a GitHub issue using
49+
the [appropriate template](https://github.com/netbox-community/netbox/issues/new/choose).
4850

4951
If you are interested in contributing to the development of NetBox, please read
5052
our [contributing guide](CONTRIBUTING.md) prior to beginning any work.
5153

5254
## Related projects
5355

54-
Please see [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions) for a list of relevant community projects.
56+
Please see [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions)
57+
for a list of relevant community projects.

docs/development/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ NetBox is maintained as a [GitHub project](https://github.com/netbox-community/n
77
Communication among developers should always occur via public channels:
88

99
* [GitHub issues](https://github.com/netbox-community/netbox/issues) - All feature requests, bug reports, and other substantial changes to the code base **must** be documented in an issue.
10-
* [The mailing list](https://groups.google.com/g/netbox-discuss) - The preferred forum for general discussion and support issues. Ideal for shaping a feature request prior to submitting an issue.
10+
* [GitHub discussions](https://github.com/netbox-community/netbox/discussions) - The preferred forum for general discussion and support issues. Ideal for shaping a feature request prior to submitting an issue.
11+
* [The mailing list](https://groups.google.com/g/netbox-discuss) - An alternative forum for general discussion (GitHub is preferred).
1112
* [#netbox on NetworkToCode](http://slack.networktocode.com/) - Good for quick chats. Avoid any discussion that might need to be referenced later on, as the chat history is not retained long.
1213

1314
## Governance

docs/release-notes/version-2.9.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# NetBox v2.9
22

3-
## v2.9.11 (FUTURE)
3+
## v2.9.11 (2020-12-11)
44

55
### Enhancements
66

77
* [#5424](https://github.com/netbox-community/netbox/issues/5424) - Allow passing Python code to `nbshell` using `--command`
8+
* [#5439](https://github.com/netbox-community/netbox/issues/5439) - Add CS and SN fiber port types
89

910
### Bug Fixes
1011

1112
* [#5383](https://github.com/netbox-community/netbox/issues/5383) - Fix setting user password via REST API
1213
* [#5396](https://github.com/netbox-community/netbox/issues/5396) - Fix uniqueness constraint for virtual machine names
14+
* [#5387](https://github.com/netbox-community/netbox/issues/5387) - Fix error when rendering config contexts when objects have multiple tags assigned
1315
* [#5407](https://github.com/netbox-community/netbox/issues/5407) - Add direct link to secret on secrets list
1416
* [#5408](https://github.com/netbox-community/netbox/issues/5408) - Fix updating secrets without setting new plaintext
1517
* [#5410](https://github.com/netbox-community/netbox/issues/5410) - Restore tags field on cable connection forms
18+
* [#5433](https://github.com/netbox-community/netbox/issues/5433) - Exclude SVG files from front/rear image upload for device types (currently unsupported)
1619
* [#5436](https://github.com/netbox-community/netbox/issues/5436) - Show assigned IP addresses in interfaces list
20+
* [#5446](https://github.com/netbox-community/netbox/issues/5446) - Fix validation for plugin version and required settings
1721

1822
---
1923

netbox/dcim/choices.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,8 @@ class PortTypeChoices(ChoiceSet):
887887
TYPE_LSH = 'lsh'
888888
TYPE_LSH_APC = 'lsh-apc'
889889
TYPE_SPLICE = 'splice'
890+
TYPE_CS = 'cs'
891+
TYPE_SN = 'sn'
890892

891893
CHOICES = (
892894
(
@@ -914,6 +916,8 @@ class PortTypeChoices(ChoiceSet):
914916
(TYPE_SC, 'SC'),
915917
(TYPE_SC_APC, 'SC/APC'),
916918
(TYPE_ST, 'ST'),
919+
(TYPE_CS, 'CS'),
920+
(TYPE_SN, 'SN'),
917921
(TYPE_SPLICE, 'Splice'),
918922
)
919923
)

netbox/dcim/forms.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,14 @@ class Meta:
922922
'front_image', 'rear_image', 'comments', 'tags',
923923
]
924924
widgets = {
925-
'subdevice_role': StaticSelect2()
925+
'subdevice_role': StaticSelect2(),
926+
# Exclude SVG images (unsupported by PIL)
927+
'front_image': forms.FileInput(attrs={
928+
'accept': 'image/bmp,image/gif,image/jpeg,image/png,image/tiff'
929+
}),
930+
'rear_image': forms.FileInput(attrs={
931+
'accept': 'image/bmp,image/gif,image/jpeg,image/png,image/tiff'
932+
})
926933
}
927934

928935

netbox/extras/plugins/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from packaging import version
44

55
from django.apps import AppConfig
6-
from django.conf import settings
76
from django.core.exceptions import ImproperlyConfigured
87
from django.template.loader import get_template
98

@@ -71,10 +70,10 @@ def ready(self):
7170
register_menu_items(self.verbose_name, menu_items)
7271

7372
@classmethod
74-
def validate(cls, user_config):
73+
def validate(cls, user_config, netbox_version):
7574

7675
# Enforce version constraints
77-
current_version = version.parse(settings.VERSION)
76+
current_version = version.parse(netbox_version)
7877
if cls.min_version is not None:
7978
min_version = version.parse(cls.min_version)
8079
if current_version < min_version:

netbox/extras/querysets.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.db.models import OuterRef, Subquery, Q
22

3+
from extras.models.tags import TaggedItem
34
from utilities.query_functions import EmptyGroupByJSONBAgg, OrderableJSONBAgg
45
from utilities.querysets import RestrictedQuerySet
56

@@ -81,11 +82,25 @@ def annotate_config_context_data(self):
8182

8283
def _get_config_context_filters(self):
8384
# Construct the set of Q objects for the specific object types
85+
tag_query_filters = {
86+
"object_id": OuterRef(OuterRef('pk')),
87+
"content_type__app_label": self.model._meta.app_label,
88+
"content_type__model": self.model._meta.model_name
89+
}
8490
base_query = Q(
8591
Q(platforms=OuterRef('platform')) | Q(platforms=None),
8692
Q(tenant_groups=OuterRef('tenant__group')) | Q(tenant_groups=None),
8793
Q(tenants=OuterRef('tenant')) | Q(tenants=None),
88-
Q(tags=OuterRef('tags')) | Q(tags=None),
94+
Q(
95+
tags__pk__in=Subquery(
96+
TaggedItem.objects.filter(
97+
**tag_query_filters
98+
).values_list(
99+
'tag_id',
100+
flat=True
101+
)
102+
)
103+
) | Q(tags=None),
89104
is_active=True,
90105
)
91106

netbox/extras/tests/test_models.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,46 @@ def test_multiple_tags_return_distinct_objects(self):
321321
annotated_queryset = Device.objects.filter(name=device.name).annotate_config_context_data()
322322
self.assertEqual(ConfigContext.objects.get_for_object(device).count(), 1)
323323
self.assertEqual(device.get_config_context(), annotated_queryset[0].get_config_context())
324+
325+
def test_multiple_tags_return_distinct_objects_with_seperate_config_contexts(self):
326+
"""
327+
Tagged items use a generic relationship, which results in duplicate rows being returned when queried.
328+
This is combatted by by appending distinct() to the config context querysets. This test creates a config
329+
context assigned to two tags and ensures objects related by those same two tags result in only a single
330+
config context record being returned.
331+
332+
This test case is seperate from the above in that it deals with multiple config context objects in play.
333+
334+
See https://github.com/netbox-community/netbox/issues/5387
335+
"""
336+
tag_context_1 = ConfigContext.objects.create(
337+
name="tag-1",
338+
weight=100,
339+
data={
340+
"tag": 1
341+
}
342+
)
343+
tag_context_1.tags.add(self.tag)
344+
tag_context_2 = ConfigContext.objects.create(
345+
name="tag-2",
346+
weight=100,
347+
data={
348+
"tag": 1
349+
}
350+
)
351+
tag_context_2.tags.add(self.tag2)
352+
353+
device = Device.objects.create(
354+
name="Device 3",
355+
site=self.site,
356+
tenant=self.tenant,
357+
platform=self.platform,
358+
device_role=self.devicerole,
359+
device_type=self.devicetype
360+
)
361+
device.tags.add(self.tag)
362+
device.tags.add(self.tag2)
363+
364+
annotated_queryset = Device.objects.filter(name=device.name).annotate_config_context_data()
365+
self.assertEqual(ConfigContext.objects.get_for_object(device).count(), 2)
366+
self.assertEqual(device.get_config_context(), annotated_queryset[0].get_config_context())

0 commit comments

Comments
 (0)