Class: Installation::AutoinstIssues::List

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
library/general/src/lib/installation/autoinst_issues/list.rb

Overview

List of AutoYaST problems

Examples:

Registering some partition problems

section = PartitionSection.new({})
list = List.new
list.add(Y2Storage::AutoinstIssues::MissingRoot)
list.add(Y2Storage::AutoinstIssues::InvalidValue,
          section, :size, "auto")
list.empty? #=> false

Iterating through the list of problems

list.map(&:severity) #=> [:warn]

Adding a problem with additional arguments

fd_section = Y2Firewall::AutoinstProfile::FirewallSection.new()
AutoInstall.issues_list.add(
  ::Installation::AutoinstIssues::InvalidValue,
  fd_section, "FW_DEV_INT", "1",
  _("Is not supported anymore."))

Instance Method Summary collapse

Constructor Details

#initializeList

Constructor



50
51
52
# File 'library/general/src/lib/installation/autoinst_issues/list.rb', line 50

def initialize
  @items = []
end

Instance Method Details

#add(klass, *extra_args) ⇒ Array<Issue>

Add a problem to the list

The type of the problem is class of the regarding issue e.g.: MissingRoot

If a given type of problem requires some additional arguments, they should be added when calling this method. See the next example.

Examples:

Adding a problem with additional arguments

fd_section = Y2Firewall::AutoinstProfile::FirewallSection.new()
AutoInstall.issues_list.add(
  ::Installation::AutoinstIssues::InvalidValue,
  fd_section, "FW_DEV_INT", "1",
  _("Is not supported anymore."))

Parameters:

  • klass (Class)

    Issue class

  • extra_args (Array)

    Additional arguments for the given problem

Returns:

  • (Array<Issue>)

    List of problems



72
73
74
# File 'library/general/src/lib/installation/autoinst_issues/list.rb', line 72

def add(klass, *extra_args)
  self << klass.new(*extra_args)
end

#fatal?Boolean

Determine whether any of the problem on the list is fatal

Returns:

  • (Boolean)

    true if any of them is a fatal problem



79
80
81
# File 'library/general/src/lib/installation/autoinst_issues/list.rb', line 79

def fatal?
  any?(&:fatal?)
end

#to_aArray<Issue>

Returns an array containing registered problems

Returns:

  • (Array<Issue>)

    List of problems



86
87
88
# File 'library/general/src/lib/installation/autoinst_issues/list.rb', line 86

def to_a
  @items
end