Skip to content

Commit

Permalink
Merge pull request #158 from yast/merge-sle-15-sp6
Browse files Browse the repository at this point in the history
Merge `SLE-15-SP6` into `master`
  • Loading branch information
imobachgs authored Aug 9, 2024
2 parents 10bda5e + e6a0d41 commit 8743ffe
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 Aug 6 11:29:06 UTC 2024 - Knut Anderssen <kanderssen@suse.com>

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

-------------------------------------------------------------------
Wed Aug 30 20:16:10 UTC 2023 - Josef Reidinger <jreidinger@suse.cz>

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: 5.0.0
Version: 5.0.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 @@ -80,10 +80,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 @@ -241,16 +242,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 8743ffe

Please sign in to comment.