Module: ForemanFogProxmox::ProxmoxVersion

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

Instance Method Summary collapse

Instance Method Details

#versionObject



35
36
37
38
39
40
41
42
43
# File 'app/models/foreman_fog_proxmox/proxmox_version.rb', line 35

def version
  v = identity_client.read_version if identity_client
  v ? v['version'] : 'Unknown'
rescue ::Foreman::Exception => e
  return 'Unkown' if e.message == 'User token expired'
rescue StandardError => e
  logger.warn("failed to get identity client version: #{e}")
  raise e
end

#version_suitable?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
32
33
# File 'app/models/foreman_fog_proxmox/proxmox_version.rb', line 24

def version_suitable?
  logger.debug("Proxmox compute resource version is #{version}")
  unless ForemanFogProxmox::Semver.semver?(version)
    raise ::Foreman::Exception,
      format(_('Proxmox version %<version>s is not semver suitable'),
        version: version)
  end

  ForemanFogProxmox::Semver.to_semver(version) >= ForemanFogProxmox::Semver.to_semver('5.3.0')
end