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 880e6e3833..3e159e87a5 100644 --- a/plugins/lookup/tss.py +++ b/plugins/lookup/tss.py @@ -170,19 +170,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()