Class: Installation::UpdatesManager
- Inherits:
-
Object
- Object
- Installation::UpdatesManager
- Includes:
- Yast::Logger
- Defined in:
- src/lib/installation/updates_manager.rb
Overview
This class takes care of managing installer updates
Installer updates are distributed as rpm-md repositories. This class tries to offer a really simple API to get updates and apply them to inst-sys.
Defined Under Namespace
Classes: CouldNotFetchUpdateFromRepo, CouldNotProbeRepo, NotValidRepo, RepoError
Constant Summary collapse
- DRIVER_UPDATES_PATHS =
[Pathname("/update"), Pathname("/download")].freeze
Instance Attribute Summary collapse
-
#driver_updates ⇒ Array<DriverUpdate>
readonly
Driver updates found in inst-sys.
-
#repositories ⇒ Array<UpdateRepository>
readonly
Repositories containing updates.
Instance Method Summary collapse
-
#add_repository(uri) ⇒ Boolean
Add an update repository.
-
#apply_all ⇒ Object
Applies all the updates.
-
#initialize(duds_paths = DRIVER_UPDATES_PATHS) ⇒ UpdatesManager
constructor
Constructor.
-
#repositories? ⇒ Boolean
Determines whether the manager has repositories with updates.
Constructor Details
#initialize(duds_paths = DRIVER_UPDATES_PATHS) ⇒ UpdatesManager
Constructor
At instantiation time, this class looks for existin driver
updates in the given duds_path
.
65 66 67 68 |
# File 'src/lib/installation/updates_manager.rb', line 65 def initialize(duds_paths = DRIVER_UPDATES_PATHS) @repositories = [] @driver_updates = Installation::DriverUpdate.find(duds_paths) end |
Instance Attribute Details
#driver_updates ⇒ Array<DriverUpdate> (readonly)
Returns Driver updates found in inst-sys.
42 43 44 |
# File 'src/lib/installation/updates_manager.rb', line 42 def driver_updates @driver_updates end |
#repositories ⇒ Array<UpdateRepository> (readonly)
Returns Repositories containing updates.
39 40 41 |
# File 'src/lib/installation/updates_manager.rb', line 39 def repositories @repositories end |
Instance Method Details
#add_repository(uri) ⇒ Boolean
Add an update repository
Most of exceptions coming from Installation::UpdateRepository are catched, except those that has something to do with applying the update itself (mounting or adding files to inst-sys). Check Installation::UpdateRepository::CouldNotMountUpdate and Installation::UpdateRepository::CouldNotBeApplied for more information.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'src/lib/installation/updates_manager.rb', line 83 def add_repository(uri) new_repository = Installation::UpdateRepository.new(uri) new_repository.fetch has_packages = !new_repository.empty? if has_packages repositories << new_repository else log.info("Update repository at #{uri} is empty. Skipping...") end has_packages rescue Installation::UpdateRepository::NotValidRepo log.warn("Update repository at #{uri} could not be found") raise NotValidRepo rescue Installation::UpdateRepository::FetchError log.error("Update repository at #{uri} was found but update could not be fetched") raise CouldNotFetchUpdateFromRepo rescue Installation::UpdateRepository::CouldNotProbeRepo log.error("Update repository at #{uri} could not be read") raise CouldNotProbeRepo end |
#apply_all ⇒ Object
Applies all the updates
It delegates the responsability of updating the inst-sys to added repositories and driver updates.
113 114 115 116 117 |
# File 'src/lib/installation/updates_manager.rb', line 113 def apply_all (repositories + driver_updates).each(&:apply) repositories.each(&:cleanup) replace_control_file end |
#repositories? ⇒ Boolean
Determines whether the manager has repositories with updates
120 121 122 |
# File 'src/lib/installation/updates_manager.rb', line 120 def repositories? !repositories.empty? end |