Class: Y2Issues::Reporter

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n, Yast::Logger
Defined in:
library/general/src/lib/y2issues/reporter.rb

Overview

This class provides a mechanism to report YaST2 issues

In order to integrate nicely with AutoYaST, it honors the Yast::Report settings.

Instance Method Summary collapse

Constructor Details

#initialize(issues, report_settings: Yast::Report.Export) ⇒ Reporter



38
39
40
41
42
43
# File 'library/general/src/lib/y2issues/reporter.rb', line 38

def initialize(issues, report_settings: Yast::Report.Export)
  textdomain "base"
  @presenter = Presenter.new(issues)
  @level = issues.error? ? :error : :warn
  @log, @show, @timeout = find_settings(report_settings, @level)
end

Instance Method Details

#report(warn: :ask, error: :abort) ⇒ Boolean

Reports the issues to the user

Depending on the given report settings, it may display a pop-up, and/or log the error.

In case of displaying the pop-up, the way to present the information and the possible return values are determined by the severity of the issues and the value of warn and error.

If the value specified for the corresponding level is :abort, the pop-up contains the information and a single button to abort, the method returns false.

If the value is :ask, the information is presented and the user is asked whether they want to continue or abort. The returned value depends on the answer.

In the value is :continue (or any other symbol), the information is displayed with a button to simply close the pop-up and the method always returns true.



64
65
66
67
68
69
# File 'library/general/src/lib/y2issues/reporter.rb', line 64

def report(warn: :ask, error: :abort)
  log_issues if @log
  return true unless @show

  show_issues(warn, error)
end