From f17690e7d02302e3ce357b5a63900f53269780b0 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 9 May 2021 22:44:39 +0200 Subject: [PATCH] fix stackpath_compute validate_config (#2448) (#2474) * 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 (cherry picked from commit 4cdff8654a8ef793736b95d84b872acf3779bdea) Co-authored-by: vbarba --- changelogs/fragments/2448-stackpath_compute-fix.yml | 2 ++ plugins/inventory/stackpath_compute.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/2448-stackpath_compute-fix.yml diff --git a/changelogs/fragments/2448-stackpath_compute-fix.yml b/changelogs/fragments/2448-stackpath_compute-fix.yml new file mode 100644 index 0000000000..196db780b1 --- /dev/null +++ b/changelogs/fragments/2448-stackpath_compute-fix.yml @@ -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)." diff --git a/plugins/inventory/stackpath_compute.py b/plugins/inventory/stackpath_compute.py index 393edac384..fb879e869e 100644 --- a/plugins/inventory/stackpath_compute.py +++ b/plugins/inventory/stackpath_compute.py @@ -102,13 +102,13 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): raise AnsibleError("plugin doesn't match this plugin") try: client_id = config['client_id'] - if client_id != 32: + if len(client_id) != 32: raise AnsibleError("client_id must be 32 characters long") except KeyError: raise AnsibleError("config missing client_id, a required option") try: client_secret = config['client_secret'] - if client_secret != 64: + if len(client_secret) != 64: raise AnsibleError("client_secret must be 64 characters long") except KeyError: raise AnsibleError("config missing client_id, a required option")