Class: Chef::Knife::ProxmoxClusterList

Inherits:
Chef::Knife show all
Includes:
ProxmoxBase
Defined in:
lib/chef/knife/proxmox_cluster_list.rb

Overview

Lists the Proxmox clusters configured in knife.

This is the one command that introspects configuration instead of calling the API: it reads Chef::Config[:proxmox_clusters] directly and reports, per cluster, whether a token secret resolves (via ENV override or the config file) WITHOUT ever printing the secret value under any output format.

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

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/chef/knife/proxmox_cluster_list.rb', line 24

def run
  unless name_args.empty?
    ui.error("This command takes no arguments")
    show_usage
    exit 1
  end

  clusters = Chef::Config[:knife][:proxmox_clusters] || {}
  if clusters.empty?
    ui.warn("no Proxmox clusters configured in knife[:proxmox_clusters]")
    return
  end

  ui.output(format_for_display(rows_for(clusters)))
end