Class: Installation::AutoinstIssues::InvalidValue

Inherits:
Issue
  • Object
show all
Includes:
Yast::Logger
Defined in:
library/general/src/lib/installation/autoinst_issues/invalid_value.rb

Overview

Represents an AutoYaST situation where an invalid value was given.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Issue

#fatal?, #warn?

Constructor Details

#initialize(section, attribute, value, description, severity = :warn) ⇒ InvalidValue

Returns a new instance of InvalidValue.

Parameters:

  • section (String)

    main section name in the AutoYaST configuration file

  • attribute (String)

    wrong attribute

  • value (String)

    wrong attribute value

  • description (String)

    additional explanation

  • severity (Symbol) (defaults to: :warn)

    :warn, :fatal = abort the installation



37
38
39
40
41
42
43
44
45
46
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 37

def initialize(section, attribute, value, description, severity = :warn)
  super()

  textdomain "base"
  @section = section
  @attribute = attribute
  @value = value
  @description = description
  @severity = severity
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



29
30
31
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 29

def attribute
  @attribute
end

#descriptionObject (readonly)

Returns the value of attribute description.



29
30
31
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 29

def description
  @description
end

#sectionObject (readonly)

Returns the value of attribute section.



29
30
31
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 29

def section
  @section
end

#severityObject (readonly)

Returns the value of attribute severity.



29
30
31
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 29

def severity
  @severity
end

#valueObject (readonly)

Returns the value of attribute value.



29
30
31
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 29

def value
  @value
end

Instance Method Details

#messageString

Return the error message to be displayed

Returns:

  • (String)

    Error message

See Also:



52
53
54
55
56
57
58
# File 'library/general/src/lib/installation/autoinst_issues/invalid_value.rb', line 52

def message
  # TRANSLATORS:
  # 'value' is a generic value (number or string) 'attribute' is an AutoYaST element
  # 'description' has already been translated in other modules.
  format(_("Invalid value '%{value}' for attribute '%{attribute}': %{description}"),
    value: @value, attribute: @attribute, description: @description)
end