From 20bd065e7700d029154f45187899f75813caa150 Mon Sep 17 00:00:00 2001 From: Jeffrey van Pelt Date: Sat, 27 Feb 2021 17:06:00 +0100 Subject: [PATCH] Proxmox inventory: Add some sanitization to url parameter (#1914) * Added rstrip to the URL field to prevent issues when users add a trailing / in the config of this module * Added changelog fragment * Sorry Mr. Linter, I have removed the empty line :-) * Fixed punctuation * Fixed punctuation --- changelogs/fragments/1914-add-sanitization-to-url.yml | 3 +++ plugins/inventory/proxmox.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1914-add-sanitization-to-url.yml diff --git a/changelogs/fragments/1914-add-sanitization-to-url.yml b/changelogs/fragments/1914-add-sanitization-to-url.yml new file mode 100644 index 0000000000..3b41bcb7af --- /dev/null +++ b/changelogs/fragments/1914-add-sanitization-to-url.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - proxmox inventory - added handling of extra trailing slashes in the URL (https://github.com/ansible-collections/community.general/pull/1914). diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index da727b7a20..d21688c4d4 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -352,7 +352,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): self._read_config_data(path) # get connection host - self.proxmox_url = self.get_option('url') + self.proxmox_url = self.get_option('url').rstrip('/') self.proxmox_user = self.get_option('user') self.proxmox_password = self.get_option('password') self.cache_key = self.get_cache_key(path)