Class: Chef::Knife::ProxmoxTemplateList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProxmoxTemplateList
- Includes:
- ProxmoxBase
- Defined in:
- lib/chef/knife/proxmox_template_list.rb
Overview
List the qemu templates available on the selected Proxmox cluster. Read-only: a single /cluster/resources round-trip filtered to templates, rendered through knife’s display pipeline so –format json|yaml works out of the box.
Constant Summary
Constants included from ProxmoxBase
Chef::Knife::ProxmoxBase::ENV_SECRET_GLOBAL, Chef::Knife::ProxmoxBase::ENV_SECRET_PREFIX
Instance Method Summary collapse
Methods included from ProxmoxBase
included, #msg_pair, #proxmox_api, #proxmox_client, #proxmox_cluster_config, #proxmox_token_secret_present?
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/chef/knife/proxmox_template_list.rb', line 23 def run unless name_args.empty? ui.error("knife proxmox template list takes no arguments") show_usage exit 1 end rows = proxmox_api.list_resources(template: true).map do |resource| { name: resource[:name], vmid: resource[:vmid], node: resource[:node], maxdisk: resource[:maxdisk], maxmem: resource[:maxmem], } end ui.output(format_for_display(rows)) end |