From 34b6fb74eb55c5b9a57e283445b132dc96b483cf Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 6 Apr 2025 14:16:36 +0200 Subject: [PATCH] proxmox_disk: fail gracefully if storage hasn't been provided by the user (#9963) Fail gracefully if storage hasn't been provided by the user. --- changelogs/fragments/9963-proxmox_disk-storage.yml | 2 ++ plugins/modules/proxmox_disk.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/9963-proxmox_disk-storage.yml diff --git a/changelogs/fragments/9963-proxmox_disk-storage.yml b/changelogs/fragments/9963-proxmox_disk-storage.yml new file mode 100644 index 0000000000..a93fb7d022 --- /dev/null +++ b/changelogs/fragments/9963-proxmox_disk-storage.yml @@ -0,0 +1,2 @@ +bugfixes: + - "proxmox_disk - fail gracefully if ``storage`` is required but not provided by the user (https://github.com/ansible-collections/community.general/issues/9941, https://github.com/ansible-collections/community.general/pull/9963)." diff --git a/plugins/modules/proxmox_disk.py b/plugins/modules/proxmox_disk.py index 8bf8e96108..75eb0001e6 100644 --- a/plugins/modules/proxmox_disk.py +++ b/plugins/modules/proxmox_disk.py @@ -554,6 +554,8 @@ class ProxmoxDiskAnsible(ProxmoxAnsible): ok_str = "CD-ROM was created on %s bus in VM %s" else: config_str = self.module.params["storage"] + if not config_str: + self.module.fail_json(msg="The storage option must be specified.") if self.module.params.get("media") != "cdrom": config_str += ":%s" % (self.module.params["size"]) ok_str = "Disk %s created in VM %s"