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

fix stackpath_compute validate_config (#2448)

* fix stackpath_compute validate_config

get the lenght for the client_id / client_secret to validate inventory configuration

* Add changelog fragment.

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
vbarba 2021-05-09 22:25:00 +02:00 committed by GitHub
parent 7386326258
commit 4cdff8654a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "stackpath_compute inventory script - fix broken validation checks for client ID and client secret (https://github.com/ansible-collections/community.general/pull/2448)."

View file

@ -102,13 +102,13 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
raise AnsibleError("plugin doesn't match this plugin") raise AnsibleError("plugin doesn't match this plugin")
try: try:
client_id = config['client_id'] client_id = config['client_id']
if client_id != 32: if len(client_id) != 32:
raise AnsibleError("client_id must be 32 characters long") raise AnsibleError("client_id must be 32 characters long")
except KeyError: except KeyError:
raise AnsibleError("config missing client_id, a required option") raise AnsibleError("config missing client_id, a required option")
try: try:
client_secret = config['client_secret'] client_secret = config['client_secret']
if client_secret != 64: if len(client_secret) != 64:
raise AnsibleError("client_secret must be 64 characters long") raise AnsibleError("client_secret must be 64 characters long")
except KeyError: except KeyError:
raise AnsibleError("config missing client_id, a required option") raise AnsibleError("config missing client_id, a required option")