mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-22 11:38:45 -06:00
Compare commits
2 Commits
main
...
21249-omit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c340b6353 | ||
|
|
062b54c6c0 |
43
.github/ISSUE_TEMPLATE/03-performance.yaml
vendored
43
.github/ISSUE_TEMPLATE/03-performance.yaml
vendored
@@ -1,43 +0,0 @@
|
|||||||
---
|
|
||||||
name: 🏁 Performance
|
|
||||||
type: Performance
|
|
||||||
description: An opportunity to improve application performance
|
|
||||||
labels: ["netbox", "type: performance", "status: needs triage"]
|
|
||||||
body:
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: NetBox Version
|
|
||||||
description: What version of NetBox are you currently running?
|
|
||||||
placeholder: v4.5.1
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Python Version
|
|
||||||
description: What version of Python are you currently running?
|
|
||||||
options:
|
|
||||||
- "3.12"
|
|
||||||
- "3.13"
|
|
||||||
- "3.14"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Area(s) of Concern
|
|
||||||
description: Which application interface(s) are affected?
|
|
||||||
options:
|
|
||||||
- label: User Interface
|
|
||||||
- label: REST API
|
|
||||||
- label: GraphQL API
|
|
||||||
- label: Python ORM
|
|
||||||
- label: Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Details
|
|
||||||
description: >
|
|
||||||
Describe in detail the operations being performed and the indications of a performance issue.
|
|
||||||
Include any relevant testing parameters, benchmarks, and expected results.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
@@ -86,7 +86,7 @@ def enqueue_event(queue, instance, request, event_type):
|
|||||||
|
|
||||||
|
|
||||||
def process_event_rules(event_rules, object_type, event_type, data, username=None, snapshots=None, request=None):
|
def process_event_rules(event_rules, object_type, event_type, data, username=None, snapshots=None, request=None):
|
||||||
user = User.objects.get(username=username) if username else None
|
user = None # To be resolved from the username if needed
|
||||||
|
|
||||||
for event_rule in event_rules:
|
for event_rule in event_rules:
|
||||||
|
|
||||||
@@ -134,6 +134,10 @@ def process_event_rules(event_rules, object_type, event_type, data, username=Non
|
|||||||
# Resolve the script from action parameters
|
# Resolve the script from action parameters
|
||||||
script = event_rule.action_object.python_class()
|
script = event_rule.action_object.python_class()
|
||||||
|
|
||||||
|
# Retrieve the User if not already resolved
|
||||||
|
if user is None:
|
||||||
|
user = User.objects.get(username=username)
|
||||||
|
|
||||||
# Enqueue a Job to record the script's execution
|
# Enqueue a Job to record the script's execution
|
||||||
from extras.jobs import ScriptJob
|
from extras.jobs import ScriptJob
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
|
|||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from django.test import tag, TestCase
|
from django.test import tag, TestCase
|
||||||
|
|
||||||
from core.models import AutoSyncRecord, DataSource, ObjectType
|
from core.models import DataSource, ObjectType
|
||||||
from dcim.models import Device, DeviceRole, DeviceType, Location, Manufacturer, Platform, Region, Site, SiteGroup
|
from dcim.models import Device, DeviceRole, DeviceType, Location, Manufacturer, Platform, Region, Site, SiteGroup
|
||||||
from extras.models import ConfigContext, ConfigContextProfile, ConfigTemplate, ImageAttachment, Tag, TaggedItem
|
from extras.models import ConfigContext, ConfigContextProfile, ConfigTemplate, ImageAttachment, Tag, TaggedItem
|
||||||
from tenancy.models import Tenant, TenantGroup
|
from tenancy.models import Tenant, TenantGroup
|
||||||
@@ -754,53 +754,3 @@ class ConfigTemplateTest(TestCase):
|
|||||||
@tag('regression')
|
@tag('regression')
|
||||||
def test_config_template_with_data_source_nested_templates(self):
|
def test_config_template_with_data_source_nested_templates(self):
|
||||||
self.assertEqual(self.BASE_TEMPLATE, self.main_config_template.render({}))
|
self.assertEqual(self.BASE_TEMPLATE, self.main_config_template.render({}))
|
||||||
|
|
||||||
@tag('regression')
|
|
||||||
def test_autosyncrecord_cleanup_on_detach(self):
|
|
||||||
"""Test that AutoSyncRecord is deleted when detaching from DataSource."""
|
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
|
||||||
templates_dir = Path(temp_dir) / "templates"
|
|
||||||
templates_dir.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
self._create_template_file(templates_dir, 'test.j2', 'Test content')
|
|
||||||
|
|
||||||
data_source = DataSource(
|
|
||||||
name="Test DataSource for Detach",
|
|
||||||
type="local",
|
|
||||||
source_url=str(templates_dir),
|
|
||||||
)
|
|
||||||
data_source.save()
|
|
||||||
data_source.sync()
|
|
||||||
|
|
||||||
data_file = data_source.datafiles.filter(path__endswith='test.j2').first()
|
|
||||||
|
|
||||||
# Create a ConfigTemplate with data_file and auto_sync_enabled
|
|
||||||
config_template = ConfigTemplate(
|
|
||||||
name="TestTemplateForDetach",
|
|
||||||
data_file=data_file,
|
|
||||||
auto_sync_enabled=True
|
|
||||||
)
|
|
||||||
config_template.clean()
|
|
||||||
config_template.save()
|
|
||||||
|
|
||||||
# Verify AutoSyncRecord was created
|
|
||||||
object_type = ObjectType.objects.get_for_model(ConfigTemplate)
|
|
||||||
autosync_records = AutoSyncRecord.objects.filter(
|
|
||||||
object_type=object_type,
|
|
||||||
object_id=config_template.pk
|
|
||||||
)
|
|
||||||
self.assertEqual(autosync_records.count(), 1, "AutoSyncRecord should be created")
|
|
||||||
|
|
||||||
# Detach from DataSource
|
|
||||||
config_template.data_file = None
|
|
||||||
config_template.data_source = None
|
|
||||||
config_template.auto_sync_enabled = False
|
|
||||||
config_template.clean()
|
|
||||||
config_template.save()
|
|
||||||
|
|
||||||
# Verify AutoSyncRecord was deleted
|
|
||||||
autosync_records = AutoSyncRecord.objects.filter(
|
|
||||||
object_type=object_type,
|
|
||||||
object_id=config_template.pk
|
|
||||||
)
|
|
||||||
self.assertEqual(autosync_records.count(), 0, "AutoSyncRecord should be deleted after detaching")
|
|
||||||
|
|||||||
@@ -569,6 +569,7 @@ class SyncedDataMixin(models.Model):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
AutoSyncRecord.objects.filter(
|
AutoSyncRecord.objects.filter(
|
||||||
|
datafile=self.data_file,
|
||||||
object_type=object_type,
|
object_type=object_type,
|
||||||
object_id=self.pk
|
object_id=self.pk
|
||||||
).delete()
|
).delete()
|
||||||
@@ -581,6 +582,7 @@ class SyncedDataMixin(models.Model):
|
|||||||
# Delete AutoSyncRecord
|
# Delete AutoSyncRecord
|
||||||
object_type = ObjectType.objects.get_for_model(self)
|
object_type = ObjectType.objects.get_for_model(self)
|
||||||
AutoSyncRecord.objects.filter(
|
AutoSyncRecord.objects.filter(
|
||||||
|
datafile=self.data_file,
|
||||||
object_type=object_type,
|
object_type=object_type,
|
||||||
object_id=self.pk
|
object_id=self.pk
|
||||||
).delete()
|
).delete()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-01-22 05:07+0000\n"
|
"POT-Creation-Date: 2026-01-21 05:07+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -12037,7 +12037,7 @@ msgstr ""
|
|||||||
msgid "date synced"
|
msgid "date synced"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/netbox/models/features.py:621
|
#: netbox/netbox/models/features.py:623
|
||||||
#, python-brace-format
|
#, python-brace-format
|
||||||
msgid "{class_name} must implement a sync_data() method."
|
msgid "{class_name} must implement a sync_data() method."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -13935,8 +13935,8 @@ msgid "No VLANs Assigned"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/dcim/inc/interface_vlans_table.html:44
|
#: netbox/templates/dcim/inc/interface_vlans_table.html:44
|
||||||
#: netbox/templates/ipam/inc/max_depth.html:11
|
#: netbox/templates/ipam/prefix_list.html:16
|
||||||
#: netbox/templates/ipam/inc/max_length.html:11
|
#: netbox/templates/ipam/prefix_list.html:33
|
||||||
msgid "Clear"
|
msgid "Clear"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -15053,8 +15053,8 @@ msgstr ""
|
|||||||
msgid "Date Added"
|
msgid "Date Added"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/ipam/aggregate/prefixes.html:10
|
#: netbox/templates/ipam/aggregate/prefixes.html:8
|
||||||
#: netbox/templates/ipam/prefix/prefixes.html:10
|
#: netbox/templates/ipam/prefix/prefixes.html:8
|
||||||
#: netbox/templates/ipam/role.html:10
|
#: netbox/templates/ipam/role.html:10
|
||||||
msgid "Add Prefix"
|
msgid "Add Prefix"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -15083,14 +15083,6 @@ msgstr ""
|
|||||||
msgid "Bulk Create"
|
msgid "Bulk Create"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/ipam/inc/max_depth.html:6
|
|
||||||
msgid "Max Depth"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: netbox/templates/ipam/inc/max_length.html:6
|
|
||||||
msgid "Max Length"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: netbox/templates/ipam/inc/panels/fhrp_groups.html:10
|
#: netbox/templates/ipam/inc/panels/fhrp_groups.html:10
|
||||||
msgid "Create Group"
|
msgid "Create Group"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -15192,6 +15184,14 @@ msgstr ""
|
|||||||
msgid "Hide Depth Indicators"
|
msgid "Hide Depth Indicators"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: netbox/templates/ipam/prefix_list.html:11
|
||||||
|
msgid "Max Depth"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: netbox/templates/ipam/prefix_list.html:28
|
||||||
|
msgid "Max Length"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/ipam/rir.html:10
|
#: netbox/templates/ipam/rir.html:10
|
||||||
msgid "Add Aggregate"
|
msgid "Add Aggregate"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user