From ce421dbd7d9ccc67680509af7286a943c46a0c2a Mon Sep 17 00:00:00 2001 From: s1github Date: Mon, 21 Apr 2025 12:34:56 +0200 Subject: [PATCH] Allowing uppercase tags in proxmox & proxmox_kvm (#10024) * Allowing uppercase tags in proxmox & proxmox_kvm * Fix #9895 : fixes the 'not a valid tag' error message when the VM or container tag contains uppercase characters * Add PR URL to changelog fragment. --------- Co-authored-by: s1githug Co-authored-by: Felix Fontein --- changelogs/fragments/9895-proxmox_tags_with_uppercase_chars.yml | 2 ++ plugins/modules/proxmox.py | 2 +- plugins/modules/proxmox_kvm.py | 2 +- tests/integration/targets/proxmox/tasks/main.yml | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/9895-proxmox_tags_with_uppercase_chars.yml diff --git a/changelogs/fragments/9895-proxmox_tags_with_uppercase_chars.yml b/changelogs/fragments/9895-proxmox_tags_with_uppercase_chars.yml new file mode 100644 index 0000000000..d14b5e21b4 --- /dev/null +++ b/changelogs/fragments/9895-proxmox_tags_with_uppercase_chars.yml @@ -0,0 +1,2 @@ +minor_changes: + - proxmox and proxmox_kvm modules - allow uppercase characters in VM/container tags (https://github.com/ansible-collections/community.general/issues/9895, https://github.com/ansible-collections/community.general/pull/10024). diff --git a/plugins/modules/proxmox.py b/plugins/modules/proxmox.py index 035de02521..9dd4b13d5c 100644 --- a/plugins/modules/proxmox.py +++ b/plugins/modules/proxmox.py @@ -1696,7 +1696,7 @@ class ProxmoxLxcAnsible(ProxmoxAnsible): def validate_tags(self, tags): """Check if the specified tags are valid.""" - re_tag = re.compile(r"^[a-z0-9_][a-z0-9_\-\+\.]*$") + re_tag = re.compile(r"^[a-zA-Z0-9_][a-zA-Z0-9_\-\+\.]*$") for tag in tags: if not re_tag.match(tag): self.module.fail_json(msg="%s is not a valid tag" % tag) diff --git a/plugins/modules/proxmox_kvm.py b/plugins/modules/proxmox_kvm.py index 714633eaa2..c159ced6e6 100644 --- a/plugins/modules/proxmox_kvm.py +++ b/plugins/modules/proxmox_kvm.py @@ -1126,7 +1126,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible): # VM tags are expected to be valid and presented as a comma/semi-colon delimited string if 'tags' in kwargs: - re_tag = re.compile(r'^[a-z0-9_][a-z0-9_\-\+\.]*$') + re_tag = re.compile(r'^[a-zA-Z0-9_][a-zA-Z0-9_\-\+\.]*$') for tag in kwargs['tags']: if not re_tag.match(tag): self.module.fail_json(msg='%s is not a valid tag' % tag) diff --git a/tests/integration/targets/proxmox/tasks/main.yml b/tests/integration/targets/proxmox/tasks/main.yml index 1ce9767b70..4e393cbf3b 100644 --- a/tests/integration/targets/proxmox/tasks/main.yml +++ b/tests/integration/targets/proxmox/tasks/main.yml @@ -165,6 +165,8 @@ name: test-instance clone: 'yes' state: present + tags: + - TagWithUppercaseChars timeout: 500 register: results_kvm