From dc898dfdf8b7a7a7bdda055846b1f26d0ab38820 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 07:07:39 +0200 Subject: [PATCH] [PR #6770/70e2048d backport][stable-7] proxmox_disk: fix failure to create cdrom (#6796) proxmox_disk: fix failure to create cdrom (#6770) * proxmox_disk: fix failure to create cdrom * Add changelog fragment 6770 * Update changelogs/fragments/6770-proxmox_disk_create_cdrom.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit 70e2048d8c38c3df8f029b6adcde4fe8551f415d) Co-authored-by: exodious <10215736+exodious@users.noreply.github.com> --- changelogs/fragments/6770-proxmox_disk_create_cdrom.yml | 2 ++ plugins/modules/proxmox_disk.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/6770-proxmox_disk_create_cdrom.yml diff --git a/changelogs/fragments/6770-proxmox_disk_create_cdrom.yml b/changelogs/fragments/6770-proxmox_disk_create_cdrom.yml new file mode 100644 index 0000000000..062ff4c6d7 --- /dev/null +++ b/changelogs/fragments/6770-proxmox_disk_create_cdrom.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_disk - fix unable to create ``cdrom`` media due to ``size`` always being appended (https://github.com/ansible-collections/community.general/pull/6770). diff --git a/plugins/modules/proxmox_disk.py b/plugins/modules/proxmox_disk.py index 8b158e7062..e80b4f7da9 100644 --- a/plugins/modules/proxmox_disk.py +++ b/plugins/modules/proxmox_disk.py @@ -505,7 +505,9 @@ class ProxmoxDiskAnsible(ProxmoxAnsible): timeout_str = "Reached timeout while importing VM disk. Last line in task before timeout: %s" ok_str = "Disk %s imported into VM %s" else: - config_str = "%s:%s" % (self.module.params["storage"], self.module.params["size"]) + config_str = self.module.params["storage"] + if self.module.params.get("media") != "cdrom": + config_str += ":%s" % (self.module.params["size"]) ok_str = "Disk %s created in VM %s" timeout_str = "Reached timeout while creating VM disk. Last line in task before timeout: %s"