From fb4469a57dd9bf0796a3e5b3f86236059105183d Mon Sep 17 00:00:00 2001 From: Leo Kirchner Date: Fri, 19 Apr 2024 01:06:09 +0200 Subject: [PATCH] fixes credential cache when using Nautobot secrets (#153) The cherry-picked feature included the new (2.x) name for the relation 'Secret -> SecretsGroupAssociation' - this branch should use the 1.6 name. --- .../plugins/credentials/nautobot_secrets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nautobot_plugin_nornir/plugins/credentials/nautobot_secrets.py b/nautobot_plugin_nornir/plugins/credentials/nautobot_secrets.py index 3eaf568..04ef1fa 100644 --- a/nautobot_plugin_nornir/plugins/credentials/nautobot_secrets.py +++ b/nautobot_plugin_nornir/plugins/credentials/nautobot_secrets.py @@ -129,10 +129,10 @@ def get_device_creds(self, device): for sec in device.secrets_group.secrets.all(): secret_value = self.creds_cache.get(self._get_or_cache_secret_key(device, sec)) current_secret_type = getattr( - SecretsGroupSecretTypeChoices, f"TYPE_{sec.secrets_group_associations.first().secret_type.upper()}" + SecretsGroupSecretTypeChoices, f"TYPE_{sec.secretsgroupassociation_set.first().secret_type.upper()}" ) current_access_type = getattr( - SecretsGroupAccessTypeChoices, f"TYPE_{sec.secrets_group_associations.first().access_type.upper()}" + SecretsGroupAccessTypeChoices, f"TYPE_{sec.secretsgroupassociation_set.first().access_type.upper()}" ) configured_access_type = _get_access_type_value(device) if (