Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netbox: 4.1.3 -> 4.1.10 #368036

Closed
wants to merge 12 commits into from
346 changes: 346 additions & 0 deletions pkgs/by-name/ne/netbox_4_1/django-51-17620.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
--- a/netbox/extras/forms/bulk_import.py
+++ b/netbox/extras/forms/bulk_import.py
@@ -192,7 +192,7 @@
label=_('Event types'),
help_text=_('The event type(s) which will trigger this rule')
)
- action_object = forms.CharField(
+ action_object_key = forms.CharField(
label=_('Action object'),
required=True,
help_text=_('Webhook name or script as dotted path module.Class')
@@ -202,13 +202,13 @@
model = EventRule
fields = (
'name', 'description', 'enabled', 'conditions', 'object_types', 'event_types', 'action_type',
- 'action_object', 'comments', 'tags'
+ 'action_object_key', 'comments', 'tags'
)

def clean(self):
super().clean()

- action_object = self.cleaned_data.get('action_object')
+ action_object = self.cleaned_data.get('action_object_key')
action_type = self.cleaned_data.get('action_type')
if action_object and action_type:
# Webhook
--- a/netbox/extras/forms/bulk_import.py
+++ b/netbox/extras/forms/bulk_import.py
@@ -192,7 +192,7 @@
label=_('Event types'),
help_text=_('The event type(s) which will trigger this rule')
)
- action_object_key = forms.CharField(
+ action_object = forms.CharField(
label=_('Action object'),
required=True,
help_text=_('Webhook name or script as dotted path module.Class')
@@ -202,13 +202,13 @@
model = EventRule
fields = (
'name', 'description', 'enabled', 'conditions', 'object_types', 'event_types', 'action_type',
- 'action_object_key', 'comments', 'tags'
+ 'comments', 'tags'
)

def clean(self):
super().clean()

- action_object = self.cleaned_data.get('action_object_key')
+ action_object = self.cleaned_data.get('action_object')
action_type = self.cleaned_data.get('action_type')
if action_object and action_type:
# Webhook
--- a/netbox/extras/migrations/0002_squashed_0059.py
+++ b/netbox/extras/migrations/0002_squashed_0059.py
@@ -131,10 +131,6 @@
name='webhook',
unique_together={('payload_url', 'type_create', 'type_update', 'type_delete')},
),
- migrations.AlterIndexTogether(
- name='taggeditem',
- index_together={('content_type', 'object_id')},
- ),
migrations.AlterUniqueTogether(
name='exporttemplate',
unique_together={('content_type', 'name')},
--- a/netbox/extras/migrations/0087_squashed_0098.py
+++ b/netbox/extras/migrations/0087_squashed_0098.py
@@ -98,10 +98,9 @@
name='object_types',
field=models.ManyToManyField(blank=True, related_name='+', to='contenttypes.contenttype'),
),
- migrations.RenameIndex(
+ migrations.AddIndex(
model_name='taggeditem',
- new_name='extras_tagg_content_717743_idx',
- old_fields=('content_type', 'object_id'),
+ index=models.Index(fields=['content_type', 'object_id'], name='extras_tagg_content_717743_idx'),
),
migrations.CreateModel(
name='Bookmark',
--- a/netbox/ipam/forms/model_forms.py
+++ b/netbox/ipam/forms/model_forms.py
@@ -574,7 +574,7 @@
required=False,
label=_('Scope type')
)
- scope = DynamicModelChoiceField(
+ scope_key = DynamicModelChoiceField(
label=_('Scope'),
queryset=Site.objects.none(), # Initial queryset
required=False,
@@ -585,13 +585,13 @@
fieldsets = (
FieldSet('name', 'slug', 'description', 'tags', name=_('VLAN Group')),
FieldSet('vid_ranges', name=_('Child VLANs')),
- FieldSet('scope_type', 'scope', name=_('Scope')),
+ FieldSet('scope_type', 'scope_key', name=_('Scope')),
)

class Meta:
model = VLANGroup
fields = [
- 'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'scope', 'tags',
+ 'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'scope_key', 'tags',
]

def __init__(self, *args, **kwargs):
@@ -599,7 +599,7 @@
initial = kwargs.get('initial', {})

if instance is not None and instance.scope:
- initial['scope'] = instance.scope
+ initial['scope_key'] = instance.scope
kwargs['initial'] = initial

super().__init__(*args, **kwargs)
@@ -608,15 +608,15 @@
try:
scope_type = ContentType.objects.get(pk=scope_type_id)
model = scope_type.model_class()
- self.fields['scope'].queryset = model.objects.all()
- self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower
- self.fields['scope'].disabled = False
- self.fields['scope'].label = _(bettertitle(model._meta.verbose_name))
+ self.fields['scope_key'].queryset = model.objects.all()
+ self.fields['scope_key'].widget.attrs['selector'] = model._meta.label_lower
+ self.fields['scope_key'].disabled = False
+ self.fields['scope_key'].label = _(bettertitle(model._meta.verbose_name))
except ObjectDoesNotExist:
pass

if self.instance and scope_type_id != self.instance.scope_type_id:
- self.initial['scope'] = None
+ self.initial['scope_key'] = None

def clean(self):
super().clean()
--- a/netbox/ipam/forms/model_forms.py
+++ b/netbox/ipam/forms/model_forms.py
@@ -574,7 +574,7 @@
required=False,
label=_('Scope type')
)
- scope_key = DynamicModelChoiceField(
+ scope = DynamicModelChoiceField(
label=_('Scope'),
queryset=Site.objects.none(), # Initial queryset
required=False,
@@ -585,13 +585,13 @@
fieldsets = (
FieldSet('name', 'slug', 'description', 'tags', name=_('VLAN Group')),
FieldSet('vid_ranges', name=_('Child VLANs')),
- FieldSet('scope_type', 'scope_key', name=_('Scope')),
+ FieldSet('scope_type', name=_('Scope')),
)

class Meta:
model = VLANGroup
fields = [
- 'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'scope_key', 'tags',
+ 'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'tags',
]

def __init__(self, *args, **kwargs):
@@ -599,7 +599,7 @@
initial = kwargs.get('initial', {})

if instance is not None and instance.scope:
- initial['scope_key'] = instance.scope
+ initial['scope'] = instance.scope
kwargs['initial'] = initial

super().__init__(*args, **kwargs)
@@ -608,15 +608,15 @@
try:
scope_type = ContentType.objects.get(pk=scope_type_id)
model = scope_type.model_class()
- self.fields['scope_key'].queryset = model.objects.all()
- self.fields['scope_key'].widget.attrs['selector'] = model._meta.label_lower
- self.fields['scope_key'].disabled = False
- self.fields['scope_key'].label = _(bettertitle(model._meta.verbose_name))
+ self.fields['scope'].queryset = model.objects.all()
+ self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower
+ self.fields['scope'].disabled = False
+ self.fields['scope'].label = _(bettertitle(model._meta.verbose_name))
except ObjectDoesNotExist:
pass

if self.instance and scope_type_id != self.instance.scope_type_id:
- self.initial['scope_key'] = None
+ self.initial['scope'] = None

def clean(self):
super().clean()
--- a/netbox/ipam/forms/model_forms.py
+++ b/netbox/ipam/forms/model_forms.py
@@ -585,7 +585,7 @@
fieldsets = (
FieldSet('name', 'slug', 'description', 'tags', name=_('VLAN Group')),
FieldSet('vid_ranges', name=_('Child VLANs')),
- FieldSet('scope_type', name=_('Scope')),
+ FieldSet('scope_type', 'scope', name=_('Scope')),
)

class Meta:
--- a/netbox/vpn/forms/model_forms.py
+++ b/netbox/vpn/forms/model_forms.py
@@ -235,7 +235,7 @@
selector=True,
label=_('Device')
)
- termination = DynamicModelChoiceField(
+ termination_key = DynamicModelChoiceField(
queryset=Interface.objects.all(),
label=_('Tunnel interface'),
query_params={
@@ -252,13 +252,13 @@
)

fieldsets = (
- FieldSet('tunnel', 'role', 'type', 'parent', 'termination', 'outside_ip', 'tags'),
+ FieldSet('tunnel', 'role', 'type', 'parent', 'termination_key', 'outside_ip', 'tags'),
)

class Meta:
model = TunnelTermination
fields = [
- 'tunnel', 'role', 'termination', 'outside_ip', 'tags',
+ 'tunnel', 'role', 'termination_key', 'outside_ip', 'tags',
]

def __init__(self, *args, initial=None, **kwargs):
@@ -273,8 +273,8 @@
self.fields['parent'].label = _('Virtual Machine')
self.fields['parent'].queryset = VirtualMachine.objects.all()
self.fields['parent'].widget.attrs['selector'] = 'virtualization.virtualmachine'
- self.fields['termination'].queryset = VMInterface.objects.all()
- self.fields['termination'].widget.add_query_params({
+ self.fields['termination_key'].queryset = VMInterface.objects.all()
+ self.fields['termination_key'].widget.add_query_params({
'virtual_machine_id': '$parent',
})
self.fields['outside_ip'].widget.add_query_params({
@@ -283,13 +283,13 @@

if self.instance.pk:
self.fields['parent'].initial = self.instance.termination.parent_object
- self.fields['termination'].initial = self.instance.termination
+ self.fields['termination_key'].initial = self.instance.termination

def clean(self):
super().clean()

# Set the terminated object
- self.instance.termination = self.cleaned_data.get('termination')
+ self.instance.termination = self.cleaned_data.get('termination_key')


class IKEProposalForm(NetBoxModelForm):
--- a/netbox/vpn/forms/model_forms.py
+++ b/netbox/vpn/forms/model_forms.py
@@ -235,7 +235,7 @@
selector=True,
label=_('Device')
)
- termination_key = DynamicModelChoiceField(
+ termination = DynamicModelChoiceField(
queryset=Interface.objects.all(),
label=_('Tunnel interface'),
query_params={
@@ -252,13 +252,13 @@
)

fieldsets = (
- FieldSet('tunnel', 'role', 'type', 'parent', 'termination_key', 'outside_ip', 'tags'),
+ FieldSet('tunnel', 'role', 'type', 'parent', 'termination_key' 'outside_ip', 'tags'),
)

class Meta:
model = TunnelTermination
fields = [
- 'tunnel', 'role', 'termination_key', 'outside_ip', 'tags',
+ 'tunnel', 'role', 'outside_ip', 'tags',
]

def __init__(self, *args, initial=None, **kwargs):
@@ -273,8 +273,8 @@
self.fields['parent'].label = _('Virtual Machine')
self.fields['parent'].queryset = VirtualMachine.objects.all()
self.fields['parent'].widget.attrs['selector'] = 'virtualization.virtualmachine'
- self.fields['termination_key'].queryset = VMInterface.objects.all()
- self.fields['termination_key'].widget.add_query_params({
+ self.fields['termination'].queryset = VMInterface.objects.all()
+ self.fields['termination'].widget.add_query_params({
'virtual_machine_id': '$parent',
})
self.fields['outside_ip'].widget.add_query_params({
@@ -283,13 +283,13 @@

if self.instance.pk:
self.fields['parent'].initial = self.instance.termination.parent_object
- self.fields['termination_key'].initial = self.instance.termination
+ self.fields['termination'].initial = self.instance.termination

def clean(self):
super().clean()

# Set the terminated object
- self.instance.termination = self.cleaned_data.get('termination_key')
+ self.instance.termination = self.cleaned_data.get('termination')


class IKEProposalForm(NetBoxModelForm):
--- a/netbox/vpn/forms/model_forms.py
+++ b/netbox/vpn/forms/model_forms.py
@@ -252,7 +252,7 @@
)

fieldsets = (
- FieldSet('tunnel', 'role', 'type', 'parent', 'termination_key' 'outside_ip', 'tags'),
+ FieldSet('tunnel', 'role', 'type', 'parent', 'termination' 'outside_ip', 'tags'),
)

class Meta:
--- a/netbox/vpn/forms/model_forms.py
+++ b/netbox/vpn/forms/model_forms.py
@@ -252,7 +252,7 @@
)

fieldsets = (
- FieldSet('tunnel', 'role', 'type', 'parent', 'termination' 'outside_ip', 'tags'),
+ FieldSet('tunnel', 'role', 'type', 'parent', 'termination', 'outside_ip', 'tags'),
)

class Meta:
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-Django==5.0.10
+Django==5.1.3
django-cors-headers==4.6.0
django-debug-toolbar==4.4.6
django-filter==24.3

13 changes: 6 additions & 7 deletions pkgs/by-name/ne/netbox_4_1/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ let
in
py.pkgs.buildPythonApplication rec {
pname = "netbox";
version = "4.1.3";
version = "4.1.10";

format = "other";

src = fetchFromGitHub {
owner = "netbox-community";
repo = "netbox";
rev = "refs/tags/v${version}";
hash = "sha256-SRzkmRkniVDu6vYGa9Kd9exob/LHpGBPd+lRA/pbCFo=";
hash = "sha256-qKsUQeZHo3z358KXLzgQzA9bhakHaNxr4NDnGE5Nvds=";
};

patches = [
./custom-static-root.patch
(fetchpatch {
url = "https://github.com/netbox-community/netbox/pull/17620.patch";
hash = "sha256-zN2zke4qlNJUbxI8mSV+zGmEv0Qtd0zSCbCXWyE1L2k=";
})
# based on https://github.com/netbox-community/netbox/pull/17620.patch
# adjusted for new requirements.txt of 4.10.0
./django-51-17620.patch
];

propagatedBuildInputs =
Expand All @@ -48,7 +47,7 @@ py.pkgs.buildPythonApplication rec {
django-pglocks
django-prometheus
django-redis
django-rq
django-rq3
django-tables2
django-taggit
django-timezone-field
Expand Down
Loading
Loading