Hello community,

here is the log from the commit of package yast2-dns-server for 
openSUSE:Factory checked in at 2018-08-28 09:24:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-dns-server (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-dns-server.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-dns-server"

Tue Aug 28 09:24:49 2018 rev:76 rq:631816 version:4.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-dns-server/yast2-dns-server.changes        
2018-08-12 20:55:00.469422764 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-dns-server.new/yast2-dns-server.changes   
2018-08-28 09:24:52.488908603 +0200
@@ -1,0 +2,11 @@
+Mon Aug 20 09:08:17 CEST 2018 - [email protected]
+
+- Switched license in spec file from SPDX2 to SPDX3 format.
+
+-------------------------------------------------------------------
+Tue Aug 14 07:46:55 UTC 2018 - [email protected]
+
+- Manage the start mode and service status directly from Ruby.
+- 4.1.1 (related to fate#319428)
+
+-------------------------------------------------------------------

Old:
----
  yast2-dns-server-4.1.0.tar.bz2

New:
----
  yast2-dns-server-4.1.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-dns-server.spec ++++++
--- /var/tmp/diff_new_pack.MaTcNJ/_old  2018-08-28 09:24:52.864909776 +0200
+++ /var/tmp/diff_new_pack.MaTcNJ/_new  2018-08-28 09:24:52.868909788 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dns-server
-Version:        4.1.0
+Version:        4.1.1
 Release:        0
 Url:            https://github.com/yast/yast-dns-server
 
@@ -63,7 +63,7 @@
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 Summary:        YaST2 - DNS Server Configuration
-License:        GPL-2.0
+License:        GPL-2.0-only
 Group:          System/YaST
 
 %description

++++++ yast2-dns-server-4.1.0.tar.bz2 -> yast2-dns-server-4.1.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-4.1.0/package/yast2-dns-server.changes 
new/yast2-dns-server-4.1.1/package/yast2-dns-server.changes
--- old/yast2-dns-server-4.1.0/package/yast2-dns-server.changes 2018-08-10 
16:21:56.000000000 +0200
+++ new/yast2-dns-server-4.1.1/package/yast2-dns-server.changes 2018-08-27 
16:11:39.000000000 +0200
@@ -1,4 +1,15 @@
 -------------------------------------------------------------------
+Mon Aug 20 09:08:17 CEST 2018 - [email protected]
+
+- Switched license in spec file from SPDX2 to SPDX3 format.
+
+-------------------------------------------------------------------
+Tue Aug 14 07:46:55 UTC 2018 - [email protected]
+
+- Manage the start mode and service status directly from Ruby.
+- 4.1.1 (related to fate#319428)
+
+-------------------------------------------------------------------
 Tue Aug  7 12:14:35 UTC 2018 - [email protected]
 
 - Use CWM::ServiceWidget to manage the service status
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-4.1.0/package/yast2-dns-server.spec 
new/yast2-dns-server-4.1.1/package/yast2-dns-server.spec
--- old/yast2-dns-server-4.1.0/package/yast2-dns-server.spec    2018-08-10 
16:21:56.000000000 +0200
+++ new/yast2-dns-server-4.1.1/package/yast2-dns-server.spec    2018-08-27 
16:11:39.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dns-server
-Version:        4.1.0
+Version:        4.1.1
 Release:        0
 Url:            https://github.com/yast/yast-dns-server
 
@@ -63,7 +63,7 @@
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 Summary:        YaST2 - DNS Server Configuration
-License:        GPL-2.0
+License:        GPL-2.0-only
 Group:          System/YaST
 
 %description
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-4.1.0/src/include/dns-server/dialog-main.rb 
new/yast2-dns-server-4.1.1/src/include/dns-server/dialog-main.rb
--- old/yast2-dns-server-4.1.0/src/include/dns-server/dialog-main.rb    
2018-08-10 16:21:56.000000000 +0200
+++ new/yast2-dns-server-4.1.1/src/include/dns-server/dialog-main.rb    
2018-08-27 16:11:39.000000000 +0200
@@ -1898,12 +1898,32 @@
 
     # Writes DNS server settings and saves the service
     #
-    # @note currently, the DnsServer is a Perl module, reason why the write of
-    # settings is being performed in two steps.
+    # As side effect, it also sets/resets the local forwarder
     #
     # @return [Boolean] true if settings are saved successfully; false 
otherwise
     def write_settings
-      DnsServer.Write && service.save
+      return false unless DnsServer.Write
+
+      result = service.save(keep_state: Mode.auto)
+      reset_local_forwarder
+      result
+    end
+
+    # Resets the local forwarder to "resolver"
+    #
+    # Local forwarder will be changed to "resolver" if
+    #
+    #   * its current value is "bind", and
+    #   * service is stopped (was stopped or could not be (re)started or 
reloaded)
+    def reset_local_forwarder
+      return unless DnsServer.GetLocalForwarder == "bind"
+
+      service.refresh
+
+      unless service.currently_active?
+        DnsServer.SetLocalForwarder("resolver")
+        log.warn("Local forwarder set to: #{DnsServer.GetLocalForwarder}")
+      end
     end
 
     # Shows a popup asking to the user if wants to change settings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-4.1.0/src/modules/DnsServer.pm 
new/yast2-dns-server-4.1.1/src/modules/DnsServer.pm
--- old/yast2-dns-server-4.1.0/src/modules/DnsServer.pm 2018-08-10 
16:21:56.000000000 +0200
+++ new/yast2-dns-server-4.1.1/src/modules/DnsServer.pm 2018-08-27 
16:11:39.000000000 +0200
@@ -1526,49 +1526,6 @@
 
     $ret = {};
 
-    if (Mode->auto() || Mode->config())
-    {
-        # named has to be started
-        if ($start_service)
-        {
-        my $success = 1;
-        if (! $write_only)
-        {
-            # named is running
-            if (Service->Status("named") == 0) {
-            y2milestone("Reloading service 'named'");
-            $success = Service->Reload("named")
-            } else {
-            y2milestone("Restarting service 'named'");
-            $success = Service->Restart("named")
-            }
-        }
-        Service->Enable ("named");
-        if (! $success)
-        {
-            # Cannot start service 'named', because of error that follows 
Error:.  Do not translate named.
-            Report->Error (__("Error occurred while starting service 
named.\n\n"));
-            $ok = 0;
-            # There's no 'named' running -> prevent from blocking DNS queries
-            $self->SetLocalForwarder("resolver") if GetLocalForwarder() eq 
"bind";
-            y2warning("Local forwarder set to: ".GetLocalForwarder());
-        }
-        }
-        # named has to be stopped
-        else
-        {
-        if (! $write_only)
-        {
-            y2milestone("Stopping service 'named'");
-            Service->Stop("named");
-            # There's no 'named' running. Reset dns forwarder again
-            $self->SetLocalForwarder("resolver") if GetLocalForwarder() eq 
"bind";
-            y2warning("Local forwarder set to: ".GetLocalForwarder());
-        }
-        Service->Disable ("named");
-        }
-    }
-
     # First run finished
     if ($ok and first_run())
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-4.1.0/test/main_test.rb 
new/yast2-dns-server-4.1.1/test/main_test.rb
--- old/yast2-dns-server-4.1.0/test/main_test.rb        2018-08-10 
16:21:56.000000000 +0200
+++ new/yast2-dns-server-4.1.1/test/main_test.rb        2018-08-27 
16:11:39.000000000 +0200
@@ -8,6 +8,8 @@
 Yast.import "DnsServerUI"
 
 describe "DnsServerDialogMainInclude" do
+  subject(:main_dialog) { CurrentDialogMain.new }
+
   class CurrentDialogMain
     include Yast::I18n
     include Yast::UIShortcuts
@@ -16,22 +18,29 @@
     def initialize
       Yast.include self, "dns-server/dialog-main.rb"
     end
+
+    def fun_ref(*args)
+    end
   end
 
+  let(:auto) { false }
+
   before do
+    allow(Yast::Mode).to receive(:auto).and_return(auto)
     allow_any_instance_of(CurrentDialogMain).to receive(:fun_ref)
   end
 
   describe "#WriteDialog" do
-    subject(:main_dialog) { CurrentDialogMain.new }
-
     before do
       allow(Yast::DnsServer).to 
receive(:Write).and_return(dns_configuration_written)
       allow(Yast2::SystemService).to receive(:find).and_return(service)
+
+      allow(service).to receive(:currently_active?).and_return(active)
     end
 
-    let(:service) { instance_double(Yast2::SystemService, save: true) }
+    let(:service) { instance_double(Yast2::SystemService, save: true, refresh: 
true) }
     let(:dns_configuration_written) { true }
+    let(:active) { true }
 
     context "when DNS configuration is written" do
       it "saves the system service" do
@@ -43,6 +52,56 @@
       it "returns :next" do
         expect(main_dialog.WriteDialog).to eq(:next)
       end
+
+
+      context "and the local forwarder is \"bind\"" do
+        before do
+          allow(Yast2::Popup).to receive(:show)
+          allow(Yast::DnsServer).to 
receive(:GetLocalForwarder).and_return("bind")
+        end
+
+        context "but service is stopped" do
+          let(:active) { false }
+
+          it "resets the local forwarder" do
+            expect(Yast::DnsServer).to 
receive(:SetLocalForwarder).with("resolver")
+
+            main_dialog.WriteDialog
+          end
+        end
+
+        context "but service is running" do
+          let(:active) { true }
+
+          it "does not reset the local forwarder" do
+            expect(Yast::DnsServer).to_not receive(:SetLocalForwarder)
+
+            main_dialog.WriteDialog
+          end
+        end
+      end
+
+      context "and the local forwarder is not \"bind\"" do
+        before do
+          allow(Yast::DnsServer).to 
receive(:GetLocalForwarder).and_return("whatever")
+        end
+
+        it "does not reset the local forwarder" do
+          expect(Yast::DnsServer).to_not receive(:SetLocalForwarder)
+
+          main_dialog.WriteDialog
+        end
+      end
+
+      context "in auto mode" do
+        let(:auto) { true }
+
+        it "keeps the server status" do
+          expect(service).to receive(:save).with(hash_including(keep_state: 
true))
+
+          main_dialog.WriteDialog
+        end
+      end
     end
 
     context "when the configuration is not written" do
@@ -53,7 +112,7 @@
       let(:change_settings) { :yes }
       let(:dns_configuration_written) { false }
 
-      it "aks for changing the current settings" do
+      it "asks for changing the current settings" do
         expect(Yast2::Popup).to receive(:show)
           .with(instance_of(String), hash_including(buttons: :yes_no))
 


Reply via email to