Module: ForemanFogProxmox::ProxmoxOperatingSystems

Included in:
Proxmox
Defined in:
app/models/foreman_fog_proxmox/proxmox_operating_systems.rb

Instance Method Summary collapse

Instance Method Details

#available_linux_operating_systemsObject



37
38
39
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 37

def available_linux_operating_systems
  ['l24', 'l26', 'debian', 'ubuntu', 'centos', 'fedora', 'opensuse', 'archlinux', 'gentoo', 'alpine']
end

#available_operating_systemsObject



26
27
28
29
30
31
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 26

def available_operating_systems
  operating_systems = available_other_operating_systems
  operating_systems += available_linux_operating_systems
  operating_systems += available_windows_operating_systems
  operating_systems
end

#available_other_operating_systemsObject



33
34
35
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 33

def available_other_operating_systems
  ['other', 'solaris']
end

#available_windows_operating_systemsObject



41
42
43
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 41

def available_windows_operating_systems
  ['wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'win10']
end

#compute_os_types(host) ⇒ Object



22
23
24
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 22

def compute_os_types(host)
  [os_linux_types_mapping(host), os_windows_types_mapping(host), os_other_types_mapping(host)].find(&:any?) || []
end

#os_linux_types_mapping(host) ⇒ Object



45
46
47
48
49
50
51
52
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 45

def os_linux_types_mapping(host)
  if ['Debian', 'Redhat', 'Suse', 'Altlinux', 'Archlinux', 'Coreos', 'Rancheros',
      'Gentoo'].include?(host.operatingsystem.type)
    available_linux_operating_systems
  else
    []
  end
end

#os_other_types_mapping(host) ⇒ Object



58
59
60
61
62
63
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 58

def os_other_types_mapping(host)
  {
    'Freebsd' => ['other'],
    'Solaris' => ['solaris'],
  }.fetch(host.operatingsystem.type, [])
end

#os_windows_types_mapping(host) ⇒ Object



54
55
56
# File 'app/models/foreman_fog_proxmox/proxmox_operating_systems.rb', line 54

def os_windows_types_mapping(host)
  ['Windows'].include?(host.operatingsystem.type) ? available_windows_operating_systems : []
end