diff --git a/changelogs/fragments/5151-add-delinea-support-tss-lookup.yml b/changelogs/fragments/5151-add-delinea-support-tss-lookup.yml new file mode 100644 index 0000000000..38d9c9e593 --- /dev/null +++ b/changelogs/fragments/5151-add-delinea-support-tss-lookup.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - tss lookup plugin - adding support for updated Delinea library (https://github.com/DelineaXPM/python-tss-sdk/issues/9, https://github.com/ansible-collections/community.general/pull/5151). diff --git a/plugins/lookup/tss.py b/plugins/lookup/tss.py index 756f168e5b..935b5f4b46 100644 --- a/plugins/lookup/tss.py +++ b/plugins/lookup/tss.py @@ -171,19 +171,29 @@ try: HAS_TSS_SDK = True except ImportError: - SecretServer = None - SecretServerError = None - HAS_TSS_SDK = False + try: + from delinea.secrets.server import SecretServer, SecretServerError + + HAS_TSS_SDK = True + except ImportError: + SecretServer = None + SecretServerError = None + HAS_TSS_SDK = False try: from thycotic.secrets.server import PasswordGrantAuthorizer, DomainPasswordGrantAuthorizer, AccessTokenAuthorizer HAS_TSS_AUTHORIZER = True except ImportError: - PasswordGrantAuthorizer = None - DomainPasswordGrantAuthorizer = None - AccessTokenAuthorizer = None - HAS_TSS_AUTHORIZER = False + try: + from delinea.secrets.server import PasswordGrantAuthorizer, DomainPasswordGrantAuthorizer, AccessTokenAuthorizer + + HAS_TSS_AUTHORIZER = True + except ImportError: + PasswordGrantAuthorizer = None + DomainPasswordGrantAuthorizer = None + AccessTokenAuthorizer = None + HAS_TSS_AUTHORIZER = False display = Display()