mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-01 06:41:26 -07:00
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:
parent
e9997e08ed
commit
ce421dbd7d
4 changed files with 6 additions and 2 deletions
|
@ -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).
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue