1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Bug fix: Warns user if incorrect SDK version is installed (#4422) (#4450)

* 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>
(cherry picked from commit e7ffa76db6)

Co-authored-by: Ricky White <rickywhite@outlook.com>
This commit is contained in:
patchback[bot] 2022-04-05 07:49:30 +02:00 committed by GitHub
parent 182c365d87
commit cef6b81e5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -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).

View file

@ -105,11 +105,15 @@ display = Display()
class LookupModule(LookupBase): class LookupModule(LookupBase):
@staticmethod @staticmethod
def Client(vault_parameters): 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): def run(self, terms, variables, **kwargs):
if sdk_is_missing: 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) self.set_options(var_options=variables, direct=kwargs)