Class: Y2Packager::OriginalRepositorySetup

Inherits:
Object
  • Object
show all
Includes:
Singleton, Yast::Logger
Defined in:
library/packages/src/lib/y2packager/original_repository_setup.rb

Overview

This class remembers the current repository setup. This is useful during upgrade when we need to know which repositories/services were already present in the original system and which are the new repositories used for migration.

Since:

  • 4.2.60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOriginalRepositorySetup

constructor, initialize the stored lists to empty lists

Since:

  • 4.2.60


35
36
37
38
# File 'library/packages/src/lib/y2packager/original_repository_setup.rb', line 35

def initialize
  @repositories = []
  @services = []
end

Instance Attribute Details

#repositoriesObject (readonly)

Since:

  • 4.2.60


32
33
34
# File 'library/packages/src/lib/y2packager/original_repository_setup.rb', line 32

def repositories
  @repositories
end

#servicesObject (readonly)

Since:

  • 4.2.60


32
33
34
# File 'library/packages/src/lib/y2packager/original_repository_setup.rb', line 32

def services
  @services
end

Instance Method Details

#readObject

Read and store the current repository/service setup.

Since:

  • 4.2.60


41
42
43
44
45
# File 'library/packages/src/lib/y2packager/original_repository_setup.rb', line 41

def read
  @repositories = Repository.all
  @services = Service.all
  log.info("Found #{repositories.size} repositories and #{services.size} services")
end

#repository?(repository_alias) ⇒ Boolean

Is the repository present in the stored list?

Since:

  • 4.2.60


57
58
59
# File 'library/packages/src/lib/y2packager/original_repository_setup.rb', line 57

def repository?(repository_alias)
  repositories.any? { |r| r.alias == repository_alias }
end

#service?(service_alias) ⇒ Boolean

Is the service present in the stored list?

Since:

  • 4.2.60


50
51
52
# File 'library/packages/src/lib/y2packager/original_repository_setup.rb', line 50

def service?(service_alias)
  services.any? { |s| s.alias == service_alias }
end