Skip to content

Commit

Permalink
new Report Class
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Feb 17, 2020
1 parent d8f24c3 commit ea0a616
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions library/general/src/lib/cfa/sysctl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
require "yast"
require "yast2/execute"
require "cfa/sysctl"
require "cfa/conflict_report"

Yast.import "FileUtils"
Yast.import "Report"

module CFA
# CFA based API to adjust the sysctl tool configuration
Expand Down Expand Up @@ -56,8 +56,6 @@ module CFA
# sysctl.raw_forward_ipv6 = "1"
class SysctlConfig
include Yast::Logger
include Yast::I18n
extend Yast::I18n

PATHS = [
"/run/sysctl.d",
Expand Down Expand Up @@ -107,7 +105,6 @@ def save
# @param show_information [Boolean] showing a popup if it is conflicting
# @return [Boolean] true if any conflict is found; false otherwise
def conflict?(only: [], show_information: true)
textdomain "base"
return false if yast_config_file.empty?

conflicting_attrs = Sysctl::ATTRIBUTES.keys
Expand All @@ -121,19 +118,9 @@ def conflict?(only: [], show_information: true)
end

if !conflicts.empty?
log.warn("There are conflicts in sysctl files: #{conflicts}.")
log.warn("It could be that #{YAST_CONFIG_PATH} will not be written.")
if show_information
text = ""
text << _("Changed values have conflicts with:<br><br>")
conflicts.each do |filename, conflict|
text << _("File: %s<br>") % filename
text << _("Conflicting entries: %s<br>") % conflict.join(", ")
text << "<br>"
end
text << _("You will have to adapt these entries manually in order to set your changes.")
Yast::Report.LongWarning(text)
end
log.warn("There are conflicts in sysctl files: #{conflicts}.")
ConfictReport.report(conflicts) if show_information
end

!conflicts.empty?
Expand Down

0 comments on commit ea0a616

Please sign in to comment.