Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SLE-15-SP3] Fix DNS zone creation #60

Merged
merged 7 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions package/yast2-dhcp-server.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Jan 13 16:33:01 UTC 2022 - David Diaz <dgonzalez@suse.com>

- Fix DNS zone creation by fixing a maintained DNS zone check.
Reported and fixed by Daniel Pätzold <obel1x@web.de>
See github#yast/yast-dhcp-server#59.
- 4.3.2

-------------------------------------------------------------------
Tue Oct 20 11:50:49 UTC 2020 - Bernhard Wiedemann <bwiedemann@suse.com>

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


Name: yast2-dhcp-server
Version: 4.3.1
Version: 4.3.2
Release: 0
Summary: YaST2 - DHCP Server Configuration
Group: System/YaST
Expand Down
5 changes: 1 addition & 4 deletions src/include/dhcp-server/dns-server-dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ def IsDNSZoneMaintained(zone_name)
return nil
end

all_zones = DnsServerAPI.GetZones

# found or not?
Ops.get(all_zones, zone_name) == nil
DnsServerAPI.GetZones.keys.include?(zone_name)
end

def IsDNSZoneMaster(zone_name)
Expand Down
69 changes: 69 additions & 0 deletions test/dns_server_dialog_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env rspec

# Copyright (c) [2022] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require_relative "test_helper"

Yast.import "DnsServerAPI"

describe "DhcpServerDnsServerDialogsInclude" do
subject(:dialog) { TestDNSDialog.new }

class TestDNSDialog
include Yast::I18n

def initialize
Yast.include self, "dhcp-server/dns-server-dialogs.rb"
end
end

describe "#IsDNSZoneMaintained" do
before do
allow(Yast::DnsServerAPI).to receive(:GetZones).and_return(zones)
end

let(:zones) do
{
"example.org" => { "type" => "master" },
"forward.org" => { "type" => "forward" }
}
end

context "when a zone name is not given" do
it "returns nil" do
expect(dialog.IsDNSZoneMaintained(nil)).to be_nil
end
end

context "when a zone name is given" do
context "and it is included in maintained zones" do
it "returns true" do
expect(dialog.IsDNSZoneMaintained("example.org")).to eq(true)
end
end

context "but it is NOT included in maintained zones" do
it "returns false" do
expect(dialog.IsDNSZoneMaintained("not-maintained-zone.org")).to eq(false)
end
end
end
end
end
1 change: 1 addition & 0 deletions test/widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def initialize

context "port is not opened" do
before do
allow(Yast::Report).to receive(:Error)
allow(Yast::UI).to receive(:QueryWidget).with(Id("open_port"), :Value)
.and_return(false)
end
Expand Down