Skip to content

Commit

Permalink
Merge 9f827b3 into 8b808be
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Jan 8, 2019
2 parents 8b808be + 9f827b3 commit 11ab365
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
7 changes: 7 additions & 0 deletions package/yast2-firewall.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jan 8 13:22:25 CET 2019 - schubi@suse.de

- Restart running firewalld service if data has been changed.
(bsc#1114673)
- 4.1.5

-------------------------------------------------------------------
Tue Jan 8 08:53:09 UTC 2019 - knut.anderssen@suse.com

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.1.4
Version: 4.1.5
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
7 changes: 7 additions & 0 deletions src/lib/y2firewall/dialogs/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ def swap_api
# modifications
def apply_changes
return false if Yast::Mode.config
# Firewall settings will be written into the permanent configurations only.
# So the running firewalld service will not be changed. Even a reload does
# not help (see man pages). So the running firewalld service has to be
# restarted.
# Set a flag only. Restarting will be done by system_service.save.
fw.system_service.restart if fw.system_service.running? && fw.modified?

fw.write_only
fw.system_service.save
end
Expand Down
14 changes: 13 additions & 1 deletion test/lib/y2firewall/dialogs/main_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@

describe "#run" do
let(:result) { :next }
let(:firewall_service) { instance_double("Yast2::SystemService", save: true) }
let(:firewall_service) do
instance_double("Yast2::SystemService",
save: true,
running?: true,
restart: nil)
end

before do
allow_any_instance_of(CWM::Dialog).to receive(:run).and_return(result)
allow(firewall).to receive(:system_service).and_return(firewall_service)
allow(firewall).to receive(:modified?).and_return(true)
end

context "when the user accepts the changes" do
Expand All @@ -74,6 +80,12 @@
subject.run
end

it "restart the running firewalld systemd service" do
expect(firewall.system_service).to receive(:restart)

subject.run
end

it "returns :next" do
expect(subject.run).to eql(:next)
end
Expand Down

0 comments on commit 11ab365

Please sign in to comment.