Skip to content

Commit

Permalink
Bug fix: Warns user if incorrect SDK version is installed (#4422)
Browse files Browse the repository at this point in the history
* Add error handling to check correct SDK version installed

* Fix CI errors

* Added changelog fragment

* Changed exeption type

* Update changelogs fragment

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
Ricky White and felixfontein committed Apr 5, 2022
1 parent 79256b2 commit e7ffa76
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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).
8 changes: 6 additions & 2 deletions plugins/lookup/dsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@
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)

Expand Down

0 comments on commit e7ffa76

Please sign in to comment.