Class: HammerCLIForemanVirtWhoConfigure::VirtWhoConfig

Inherits:
HammerCLIForeman::Command
  • Object
show all
Defined in:
lib/hammer_cli_foreman_virt_who_configure/config.rb

Defined Under Namespace

Modules: UpdateCommons Classes: CreateCommand, DeleteCommand, DeployCommand, FetchCommand, InfoCommand, ListCommand, UpdateCommand

Class Method Summary collapse

Class Method Details

.format_filtering_mode(mode) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/hammer_cli_foreman_virt_who_configure/config.rb', line 35

def self.format_filtering_mode(mode)
  case mode
  when MODE_UNLIMITED
    _('Unlimited')
  when MODE_WHITELIST
    _('Whitelist')
  when MODE_BLACKLIST
    _('Blacklist')
  else
    _('Unknown listing mode')
  end
end

.format_interval(interval) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/hammer_cli_foreman_virt_who_configure/config.rb', line 13

def self.format_interval(interval)
  hr_interval = (interval / 60)
  if hr_interval <= 1
    _('every hour')
  else
    _('every %s hours') % (interval / 60)
  end
end

.format_status(status) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hammer_cli_foreman_virt_who_configure/config.rb', line 22

def self.format_status(status)
  case status
  when 'unknown'
    _('No Report Yet')
  when 'ok', 'out_of_date'
    _('OK')
  when 'error'
    _('Error')
  else
    _('Unknown configuration status')
  end
end

.validate_hypervisor_options(conf) ⇒ Object



48
49
50
51
52
# File 'lib/hammer_cli_foreman_virt_who_configure/config.rb', line 48

def self.validate_hypervisor_options(conf)
  options = conf['hypervisor_type'] == 'kubevirt' ? %w(hypervisor_server hypervisor_username) : %w(kubeconfig_path)
  options.append('prism_flavor', 'ahv_internal_debug') unless conf['hypervisor_type'] == 'ahv'
  conf.delete_if { |k, _v| options.include?(k) }
end