mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 18:31:25 -07:00
Proxmox add storage content listing (#7725)
Add module to list content on proxmox storage We first add a method to list storage content for proxmox, then use that new methode to add an Ansible module to list content on storage attached to a proxmox node. User can also use content filtering to define what they want to list (backup, iso, images,...). This commit also include the integration and unit test for that new module. Co-authored-by: Julian Vanden Broeck <julian.vandenbroeck@dalibo.com>
This commit is contained in:
parent
3318034403
commit
4f92f39720
5 changed files with 269 additions and 0 deletions
|
@ -180,3 +180,17 @@ class ProxmoxAnsible(object):
|
|||
return self.proxmox_api.storage.get(type=type)
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Unable to retrieve storages information with type %s: %s" % (type, e))
|
||||
|
||||
def get_storage_content(self, node, storage, content=None, vmid=None):
|
||||
try:
|
||||
return (
|
||||
self.proxmox_api.nodes(node)
|
||||
.storage(storage)
|
||||
.content()
|
||||
.get(content=content, vmid=vmid)
|
||||
)
|
||||
except Exception as e:
|
||||
self.module.fail_json(
|
||||
msg="Unable to list content on %s, %s for %s and %s: %s"
|
||||
% (node, storage, content, vmid, e)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue