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 <sgithug@free.fr>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
s1github 2025-04-21 12:34:56 +02:00 committed by GitHub
parent e9997e08ed
commit ce421dbd7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View file

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

View file

@ -1696,7 +1696,7 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
def validate_tags(self, tags): def validate_tags(self, tags):
"""Check if the specified tags are valid.""" """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: for tag in tags:
if not re_tag.match(tag): if not re_tag.match(tag):
self.module.fail_json(msg="%s is not a valid tag" % tag) self.module.fail_json(msg="%s is not a valid tag" % tag)

View file

@ -1126,7 +1126,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
# VM tags are expected to be valid and presented as a comma/semi-colon delimited string # VM tags are expected to be valid and presented as a comma/semi-colon delimited string
if 'tags' in kwargs: 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']: for tag in kwargs['tags']:
if not re_tag.match(tag): if not re_tag.match(tag):
self.module.fail_json(msg='%s is not a valid tag' % tag) self.module.fail_json(msg='%s is not a valid tag' % tag)

View file

@ -165,6 +165,8 @@
name: test-instance name: test-instance
clone: 'yes' clone: 'yes'
state: present state: present
tags:
- TagWithUppercaseChars
timeout: 500 timeout: 500
register: results_kvm register: results_kvm