Skip to content

Commit a39522a

Browse files
committed
Closes #6434: Add deprecation warning for stock secrets functionality
1 parent 546bbe5 commit a39522a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

netbox/secrets/views.py

+20
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,37 @@ class SecretRoleBulkDeleteView(generic.BulkDeleteView):
8686
# Secrets
8787
#
8888

89+
def inject_deprecation_warning(request):
90+
"""
91+
Inject a warning message notifying the user of the pending removal of secrets functionality.
92+
"""
93+
messages.warning(
94+
request,
95+
mark_safe('<i class="mdi mdi-alert"></i> The secrets functionality will be moved to a plugin in NetBox v2.12. '
96+
'Please see <a href="https://github.com/netbox-community/netbox/issues/5278">issue #5278</a> for '
97+
'more information.')
98+
)
99+
100+
89101
class SecretListView(generic.ObjectListView):
90102
queryset = Secret.objects.all()
91103
filterset = filtersets.SecretFilterSet
92104
filterset_form = forms.SecretFilterForm
93105
table = tables.SecretTable
94106
action_buttons = ('import', 'export')
95107

108+
def get(self, request):
109+
inject_deprecation_warning(request)
110+
return super().get(request)
111+
96112

97113
class SecretView(generic.ObjectView):
98114
queryset = Secret.objects.all()
99115

116+
def get(self, request, *args, **kwargs):
117+
inject_deprecation_warning(request)
118+
return super().get(request, *args, **kwargs)
119+
100120

101121
class SecretEditView(generic.ObjectEditView):
102122
queryset = Secret.objects.all()

0 commit comments

Comments
 (0)