Skip to content

Commit

Permalink
reporting conflicting files
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Feb 4, 2020
1 parent 74adc01 commit 3901050
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion library/general/src/lib/cfa/sysctl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require "cfa/sysctl"

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

module CFA
# CFA based API to adjust the sysctl tool configuration
Expand Down Expand Up @@ -56,6 +57,10 @@ module CFA
# sysctl.forward_ipv6? #=> true
class SysctlConfig
include Yast::Logger
include Yast::I18n
extend Yast::I18n

textdomain "base"

PATHS = [
"/run/sysctl.d",
Expand Down Expand Up @@ -93,7 +98,18 @@ def load
files.each(&:load)
end

def save
# Saving all sysctl settings
#
# @param check_conflicts [Boolean] checking if the settings are overruled
def save(check_conflicts: true)
if check_conflicts
conflict_files = conflict_files()
if !conflict_files.empty?
Yast::Report.Warning(_("The settings have been written to %{yast_file_name}.\n"\
"But they will be overruled be manual setting described in %{file_list}") %
{ 'yast_file_name' => YAST_CONFIG_PATH, 'file_list' => conflict_files.join(", ") })
end
end
yast_config_file&.save
end

Expand Down

0 comments on commit 3901050

Please sign in to comment.