Class: Registration::RepoState

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

Overview

store repository ID and it's original state (enabled/disabled)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo_id, enabled) ⇒ RepoState

create repository state status


134
135
136
137
# File 'src/lib/registration/repo_state.rb', line 134

def initialize(repo_id, enabled)
  @repo_id = repo_id
  @enabled = enabled
end

Instance Attribute Details

#enabledObject (readonly)

Returns the value of attribute enabled


128
129
130
# File 'src/lib/registration/repo_state.rb', line 128

def enabled
  @enabled
end

#repo_idObject (readonly)

Returns the value of attribute repo_id


128
129
130
# File 'src/lib/registration/repo_state.rb', line 128

def repo_id
  @repo_id
end

Instance Method Details

#restoreObject

set the saved repository state


140
141
142
143
# File 'src/lib/registration/repo_state.rb', line 140

def restore
  log.info "Restoring the original repository state: id: #{repo_id}, enabled: #{enabled}"
  Yast::Pkg.SourceSetEnabled(repo_id, enabled)
end