Skip to content

Commit ce421db

Browse files
s1githubs1githugfelixfontein
authored
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 <[email protected]> Co-authored-by: Felix Fontein <[email protected]>
1 parent e9997e0 commit ce421db

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- 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).

plugins/modules/proxmox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ def content_check(self, node, ostemplate, template_store):
16961696

16971697
def validate_tags(self, tags):
16981698
"""Check if the specified tags are valid."""
1699-
re_tag = re.compile(r"^[a-z0-9_][a-z0-9_\-\+\.]*$")
1699+
re_tag = re.compile(r"^[a-zA-Z0-9_][a-zA-Z0-9_\-\+\.]*$")
17001700
for tag in tags:
17011701
if not re_tag.match(tag):
17021702
self.module.fail_json(msg="%s is not a valid tag" % tag)

plugins/modules/proxmox_kvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ def create_vm(self, vmid, newid, node, name, memory, cpu, cores, sockets, update
11261126

11271127
# VM tags are expected to be valid and presented as a comma/semi-colon delimited string
11281128
if 'tags' in kwargs:
1129-
re_tag = re.compile(r'^[a-z0-9_][a-z0-9_\-\+\.]*$')
1129+
re_tag = re.compile(r'^[a-zA-Z0-9_][a-zA-Z0-9_\-\+\.]*$')
11301130
for tag in kwargs['tags']:
11311131
if not re_tag.match(tag):
11321132
self.module.fail_json(msg='%s is not a valid tag' % tag)

tests/integration/targets/proxmox/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@
165165
name: test-instance
166166
clone: 'yes'
167167
state: present
168+
tags:
169+
- TagWithUppercaseChars
168170
timeout: 500
169171
register: results_kvm
170172

0 commit comments

Comments
 (0)