Skip to content

Commit

Permalink
Merge pull request #108 from DanSheps/develop
Browse files Browse the repository at this point in the history
Update for Netbox 3.4
  • Loading branch information
DanSheps authored Dec 31, 2022
2 parents 1892e0e + ce95cf2 commit 75c6897
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
8 changes: 3 additions & 5 deletions netbox_secretstore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from extras.plugins import PluginConfig

from importlib.metadata import metadata


try:
from importlib.metadata import metadata
except ModuleNotFoundError:
from importlib_metadata import metadata

metadata = metadata('netbox_secretstore')

Expand All @@ -18,7 +16,7 @@ class NetBoxSecretStore(PluginConfig):
author_email = metadata.get('Author-email')
base_url = 'netbox_secretstore'
min_version = '3.3.0beta1'
max_version = '3.3.9'
max_version = '3.4.99'
required_settings = []
default_settings = {
'public_key_size': 2048
Expand Down
4 changes: 4 additions & 0 deletions netbox_secretstore/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from rest_framework.response import Response
from rest_framework.routers import APIRootView
from rest_framework.viewsets import ViewSet
from rest_framework.parsers import JSONParser, FormParser

from extras.api.views import CustomFieldViewSet
from netbox.api.viewsets import ModelViewSet
Expand Down Expand Up @@ -144,6 +145,9 @@ class GetSessionKeyViewSet(ViewSet):
"""
permission_classes = [IsAuthenticated]

# Override Netbox DEFAULT_PARSER_CLASSES
parser_classes = [JSONParser, FormParser]

@swagger_auto_schema(
manual_parameters=[
Parameter(
Expand Down
6 changes: 3 additions & 3 deletions netbox_secretstore/forms/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from dcim.models import Device
from netbox.forms import NetBoxModelForm
from extras.forms import CustomFieldCSVForm, CustomFieldFilterForm, CustomFieldBulkEditForm, CustomFieldForm, TagForm
from extras.forms import CustomFieldImportForm, CustomFieldFilterForm, CustomFieldBulkEditForm, CustomFieldForm, TagForm
from extras.models import Tag
from utilities.forms import (
CSVModelChoiceField, SlugField, TagFilterField, DynamicModelChoiceField,
Expand Down Expand Up @@ -52,7 +52,7 @@ class Meta:
fields = ('name', 'slug', 'description')


class SecretRoleCSVForm(CustomFieldCSVForm):
class SecretRoleCSVForm(CustomFieldImportForm):
slug = SlugField()

class Meta:
Expand Down Expand Up @@ -166,7 +166,7 @@ def save(self, *args, **kwargs):
return super().save(*args, **kwargs)


class SecretCSVForm(CustomFieldCSVForm):
class SecretCSVForm(CustomFieldImportForm):
role = CSVModelChoiceField(
queryset=SecretRole.objects.all(),
to_field_name='name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ <h4>Secret Assignment</h4>
{% endwith %}
{% render_field form.role %}
{% render_field form.name %}
{% render_field form.userkeys %}
{% render_field form.tags %}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions netbox_secretstore/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.utils.safestring import mark_safe
from django.views.generic.base import View

from netbox.views.generic import ObjectListView, ObjectView, ObjectEditView, ObjectDeleteView, ObjectImportView, \
from netbox.views.generic import ObjectListView, ObjectView, ObjectEditView, ObjectDeleteView, BulkImportView, \
BulkEditView, BulkDeleteView
from netbox_secretstore.forms import UserKeyForm, SecretRoleFilterForm

Expand Down Expand Up @@ -70,7 +70,7 @@ class SecretRoleDeleteView(ObjectDeleteView):
queryset = SecretRole.objects.all()


class SecretRoleBulkImportView(ObjectImportView):
class SecretRoleBulkImportView(BulkImportView):
queryset = SecretRole.objects.all()
form = SecretRoleCSVForm
table = SecretRoleTable
Expand Down Expand Up @@ -181,7 +181,7 @@ class SecretDeleteView(ObjectDeleteView):
queryset = Secret.objects.all()


class SecretBulkImportView(ObjectImportView):
class SecretBulkImportView(BulkImportView):
queryset = Secret.objects.all()
form = SecretCSVForm
table = SecretTable
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='netbox-secretstore',
version='1.3.0',
version='1.4.0',
description='Netbox Secret Store',
long_description='A Secret store for NetBox',
url='https://github.com/dansheps/netbox-secretstore/',
Expand Down

0 comments on commit 75c6897

Please sign in to comment.