diff --git a/changelogs/fragments/4422-warn-user-if-incorrect-SDK-version-is-installed.yaml b/changelogs/fragments/4422-warn-user-if-incorrect-SDK-version-is-installed.yaml new file mode 100644 index 0000000000..af03dae757 --- /dev/null +++ b/changelogs/fragments/4422-warn-user-if-incorrect-SDK-version-is-installed.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - dsv lookup plugin - raise an Ansible error if the wrong ``python-dsv-sdk`` version is installed (https://github.com/ansible-collections/community.general/pull/4422). \ No newline at end of file diff --git a/plugins/lookup/dsv.py b/plugins/lookup/dsv.py index d7826bcd4d..1cd9041a2e 100644 --- a/plugins/lookup/dsv.py +++ b/plugins/lookup/dsv.py @@ -105,11 +105,15 @@ display = Display() class LookupModule(LookupBase): @staticmethod def Client(vault_parameters): - return SecretsVault(**vault_parameters) + try: + vault = SecretsVault(**vault_parameters) + return vault + except TypeError: + raise AnsibleError("python-dsv-sdk==0.0.1 must be installed to use this plugin") def run(self, terms, variables, **kwargs): if sdk_is_missing: - raise AnsibleError("python-dsv-sdk must be installed to use this plugin") + raise AnsibleError("python-dsv-sdk==0.0.1 must be installed to use this plugin") self.set_options(var_options=variables, direct=kwargs)