Skip to content

Commit

Permalink
Merge pull request #174 from Onemind-Services-LLC/dev
Browse files Browse the repository at this point in the history
Release v2.1.2
  • Loading branch information
abhi1693 authored Dec 7, 2024
2 parents 56c88bb + f0557b6 commit 0985d89
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
- \[Feature\]: Enable usage of session key list and secrets list endpoints using pynetbox [\#172](https://github.com/Onemind-Services-LLC/netbox-secrets/issues/172)
- \[Bug\]: Plugin netbox\_secrets requires NetBox minimum version 4.1.0 \(current: 4.0.11\) [\#167](https://github.com/Onemind-Services-LLC/netbox-secrets/issues/167)

**Merged pull requests:**

- Release v2.1.1 [\#173](https://github.com/Onemind-Services-LLC/netbox-secrets/pull/173) ([abhi1693](https://github.com/abhi1693))
- OMS-419 fixed runtime warning [\#169](https://github.com/Onemind-Services-LLC/netbox-secrets/pull/169) ([abhi1693](https://github.com/abhi1693))

## [v2.1.0](https://github.com/Onemind-Services-LLC/netbox-secrets/tree/v2.1.0) (2024-10-18)

[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-secrets/compare/v2.0.3...v2.1.0)
Expand Down
11 changes: 5 additions & 6 deletions netbox_secrets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
from importlib.metadata import metadata

from django.db.utils import OperationalError, ProgrammingError
from django.db.models.signals import post_migrate

from netbox.plugins import PluginConfig

metadata = metadata('netbox_secrets')

def configure_generic_relations(sender, **kwargs):

def configure_generic_relations():
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType

from .constants import SECRET_ASSIGNABLE_MODELS
from .models import Secret

try:
for content_type in ContentType.objects.filter(SECRET_ASSIGNABLE_MODELS):
GenericRelation(
to=Secret,
to='netbox_secrets.Secret',
content_type_field='assigned_object_type',
object_id_field='assigned_object_id',
related_query_name=content_type.model,
related_query_name=str(content_type.model),
).contribute_to_class(
content_type.model_class(),
'secrets',
Expand Down Expand Up @@ -50,7 +49,7 @@ class NetBoxSecrets(PluginConfig):

def ready(self):
super().ready()
post_migrate.connect(configure_generic_relations, sender=self)
configure_generic_relations()


config = NetBoxSecrets
1 change: 1 addition & 0 deletions netbox_secrets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class SecretBulkDeleteView(generic.BulkDeleteView):


if plugin_settings.get('enable_contacts'):

@register_model_view(models.Secret, 'contacts')
class SecretContactsView(ObjectContactsView):
queryset = models.Secret.objects.prefetch_related('role', 'tags')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='netbox-secrets',
version='2.1.1',
version='2.1.2',
description=description,
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 0985d89

Please sign in to comment.