Class: Registration::Releasever

Inherits:
Object
  • Object
show all
Includes:
Yast::Logger
Defined in:
src/lib/registration/releasever.rb

Overview

this class handles activating the new releasever value in the package management

Constant Summary collapse

RELEASEVER_ENV =

the environment variable which overrides the system default in libzpp

"ZYPP_REPO_RELEASEVER".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ Releasever

constructor


43
44
45
# File 'src/lib/registration/releasever.rb', line 43

def initialize(version)
  @version = version
end

Instance Attribute Details

#versionObject (readonly)

the new $releasever value


33
34
35
# File 'src/lib/registration/releasever.rb', line 33

def version
  @version
end

Class Method Details

.set?Boolean

has been the $releasever set?


37
38
39
# File 'src/lib/registration/releasever.rb', line 37

def self.set?
  !ENV[RELEASEVER_ENV].nil?
end

Instance Method Details

#activateObject

activate the new releasever


48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'src/lib/registration/releasever.rb', line 48

def activate
  log.info "Setting $releasever to: #{version}"
  # export the settings
  ENV[RELEASEVER_ENV] = version

  repos = repos_to_refresh
  return if repos.empty?

  # refresh the repositories and reload the packages
  Yast::Pkg.SourceFinishAll
  Yast::Pkg.SourceRestore
  refresh(repos)
  Yast::Pkg.SourceLoad
end