Skip to content

Commit

Permalink
Merge 2f07d13 into ad91bc0
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Jan 13, 2022
2 parents ad91bc0 + 2f07d13 commit d59bc9d
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 5 deletions.
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

0 comments on commit d59bc9d

Please sign in to comment.