Skip to content

Commit

Permalink
Merge pull request #157 from yast/merge-sle-15-sp5
Browse files Browse the repository at this point in the history
Merge SLE-15-SP5 into SLE-15-SP6
  • Loading branch information
imobachgs authored Aug 5, 2024
2 parents a06dadb + 9f8002a commit 619fcaa
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
8 changes: 8 additions & 0 deletions package/yast2-firewall.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Oct 31 16:42:54 UTC 2023 - Knut Anderssen <[email protected]>

- In case of autoinstallation keep the firewall service state in
the Installation::SecuritySettings for not conflicting with the
proposal (bsc#1216615)
- 4.6.1

-------------------------------------------------------------------
Fri Sep 01 19:57:03 UTC 2023 - Josef Reidinger <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-firewall.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-firewall
Version: 4.6.0
Version: 4.6.1
Release: 0
Summary: YaST2 - Firewall Configuration
Group: System/YaST
Expand Down
24 changes: 18 additions & 6 deletions src/lib/y2firewall/clients/auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ def summary
# @return [Boolean]
def import(profile, merge = !Yast::Mode.config)
self.class.profile = profile
# It does not need to be merged with current config but could be modified
# by the AutoYaST confirm dialog.
update_service_state(profile)
return false if merge && !read(force: false)

# Obtains the default from the control file (settings) if not present.
enable if profile.fetch("enable_firewall", settings.enable_firewall)
start if profile.fetch("start_firewall", false)
autoyast.import(profile)
check_profile_for_errors
Expand Down Expand Up @@ -240,16 +241,27 @@ def settings
::Installation::SecuritySettings.instance
end

# Set that the firewall has to be enabled when writing
def enable
self.class.enable = true
# It sets which should be the firewalld service state according to the profile
# or to the product defaults settings
#
# @param profile [Hash] firewall profile section to be imported
def update_service_state(profile)
return unless self.class.enable.nil?

state = profile.fetch("enable_firewall", settings.enable_firewall)

log.info("Firewall should be enabled: #{state}")
if Yast::Mode.auto
state ? settings.enable_firewall! : settings.disable_firewall!
end
state
end

# Whether the firewalld service has to be enable or disable when writing
#
# @return [Boolean] true if has to be enabled; false otherwise
def enable?
!!self.class.enable
!!(Yast::Mode.auto ? settings.enable_firewall : self.class.enable)
end

# Set that the firewall has to be started when writing
Expand Down

0 comments on commit 619fcaa

Please sign in to comment.