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

Don't try to sort SecretsProvider class objects in plugin config features registry #1065

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion nautobot/extras/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def ready(self):
if secrets_providers is not None:
for secrets_provider in secrets_providers:
register_secrets_provider(secrets_provider)
self.features["secrets_providers"] = sorted(secrets_providers)
self.features["secrets_providers"] = sorted(p() for p in secrets_providers)
jathanism marked this conversation as resolved.
Show resolved Hide resolved

@classmethod
def validate(cls, user_config, nautobot_version):
Expand Down
8 changes: 8 additions & 0 deletions nautobot/extras/secrets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
from abc import ABC, abstractmethod, abstractproperty
from functools import total_ordering

from nautobot.extras.registry import registry

from .exceptions import SecretError, SecretParametersError, SecretProviderError, SecretValueNotFoundError


@total_ordering
class SecretsProvider(ABC):
"""Abstract base class for concrete providers of secret retrieval features."""

def __lt__(self, other):
return self.slug.lower() < other.slug.lower()

def __repr__(self):
return f"<{self.name}>"

@abstractproperty
def slug(self):
"""String uniquely identifying this class; will be used as a key to look up the class owning a given Secret."""
Expand Down