Hello community,

here is the log from the commit of package yast2-dns-server for 
openSUSE:Factory checked in at 2015-07-08 06:58:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-dns-server (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-dns-server.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-dns-server"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-dns-server/yast2-dns-server.changes        
2015-02-14 13:57:23.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-dns-server.new/yast2-dns-server.changes   
2015-07-08 06:58:57.000000000 +0200
@@ -1,0 +2,14 @@
+Mon Jun 22 16:16:14 UTC 2015 - [email protected]
+
+- bnc#922765
+  - changed default TLD from .site to .suse
+- 3.1.13
+
+-------------------------------------------------------------------
+Thu Jun 18 11:23:54 UTC 2015 - [email protected]
+
+- Avoid duplicated lines on /etc/named.conf file
+  (bsc#935129)
+- 3.1.12
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-dns-server.spec ++++++
--- /var/tmp/diff_new_pack.5UhEWQ/_old  2015-07-08 06:58:58.000000000 +0200
+++ /var/tmp/diff_new_pack.5UhEWQ/_new  2015-07-08 06:58:58.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-dns-server
 #
-# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dns-server
-Version:        3.1.11
+Version:        3.1.13
 Release:        0
 Url:            https://github.com/yast/yast-dns-server
 
@@ -55,9 +55,8 @@
 # FATE #303386: Network setup tools
 Requires:       yast2-sysconfig
 
-# DnsServerApi moved to yast2.rpm (bnc#392606)
-# DnsServerAPI::GetReverseIPforIPv6
-Requires:       yast2 >= 2.17.8
+# for default TLD definition
+Requires:       yast2 >= 3.1.134
 
 BuildArch:      noarch
 
@@ -83,6 +82,7 @@
 %defattr(-,root,root)
 %dir %{yast_yncludedir}/dns-server
 %{yast_yncludedir}/dns-server/*
+%{yast_dir}/lib/ui
 %{yast_clientdir}/dns-server.rb
 %{yast_clientdir}/dns-server_*.rb
 %{yast_moduledir}/*

++++++ yast2-dns-server-3.1.11.tar.bz2 -> yast2-dns-server-3.1.13.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/CONTRIBUTING.md 
new/yast2-dns-server-3.1.13/CONTRIBUTING.md
--- old/yast2-dns-server-3.1.11/CONTRIBUTING.md 2015-02-13 14:26:10.000000000 
+0100
+++ new/yast2-dns-server-3.1.13/CONTRIBUTING.md 2015-06-23 10:01:26.000000000 
+0200
@@ -12,13 +12,13 @@
 -----------
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
+[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
 or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
 
registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
 if you don't have an account yet.)
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/) or GitHub issues. We can't guarantee
+[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee
 that every bug will be fixed, but we'll try.
 
 When creating a bug report, please follow our [bug reporting
@@ -71,7 +71,7 @@
 [widely used
 
conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
 
-If your commit is related to a bug in Buzgilla or an issue on GitHub, make sure
+If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure
 you mention it in the commit message for cross-reference. Use format like
 bnc#775814 or gh#yast/yast-foo#42. See also [GitHub
 
autolinking](https://help.github.com/articles/github-flavored-markdown#references)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/package/yast2-dns-server.changes 
new/yast2-dns-server-3.1.13/package/yast2-dns-server.changes
--- old/yast2-dns-server-3.1.11/package/yast2-dns-server.changes        
2015-02-13 14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/package/yast2-dns-server.changes        
2015-06-23 10:01:26.000000000 +0200
@@ -1,4 +1,18 @@
 -------------------------------------------------------------------
+Mon Jun 22 16:16:14 UTC 2015 - [email protected]
+
+- bnc#922765
+  - changed default TLD from .site to .suse
+- 3.1.13
+
+-------------------------------------------------------------------
+Thu Jun 18 11:23:54 UTC 2015 - [email protected]
+
+- Avoid duplicated lines on /etc/named.conf file
+  (bsc#935129)
+- 3.1.12
+
+-------------------------------------------------------------------
 Fri Feb 13 11:18:34 UTC 2015 - [email protected]
 
 - The unit tests are now compatible with RSpec 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/package/yast2-dns-server.spec 
new/yast2-dns-server-3.1.13/package/yast2-dns-server.spec
--- old/yast2-dns-server-3.1.11/package/yast2-dns-server.spec   2015-02-13 
14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/package/yast2-dns-server.spec   2015-06-23 
10:01:26.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dns-server
-Version:        3.1.11
+Version:        3.1.13
 Release:        0
 Url:            https://github.com/yast/yast-dns-server
 
@@ -55,9 +55,8 @@
 # FATE #303386: Network setup tools
 Requires:       yast2-sysconfig
 
-# DnsServerApi moved to yast2.rpm (bnc#392606)
-# DnsServerAPI::GetReverseIPforIPv6
-Requires:       yast2 >= 2.17.8
+# for default TLD definition
+Requires:       yast2 >= 3.1.134
 
 BuildArch:      noarch
 
@@ -83,6 +82,7 @@
 %defattr(-,root,root)
 %dir %{yast_yncludedir}/dns-server
 %{yast_yncludedir}/dns-server/*
+%{yast_dir}/lib/ui
 %{yast_clientdir}/dns-server.rb
 %{yast_clientdir}/dns-server_*.rb
 %{yast_moduledir}/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/src/Makefile.am 
new/yast2-dns-server-3.1.13/src/Makefile.am
--- old/yast2-dns-server-3.1.11/src/Makefile.am 2015-02-13 14:26:11.000000000 
+0100
+++ new/yast2-dns-server-3.1.13/src/Makefile.am 2015-06-23 10:01:26.000000000 
+0200
@@ -30,6 +30,10 @@
   include/dns-server/cmdline.rb \
   include/dns-server/helps.rb
 
+ylibdir = @ylibdir@/ui
+ylib_DATA = \
+  lib/ui/srv_status_component.rb
+
 scrconf_DATA = \
   scrconf/dns_zone.scr \
   scrconf/cfg_named.scr \
@@ -49,6 +53,6 @@
 desktop_DATA = \
   desktop/dns-server.desktop
 
-EXTRA_DIST = $(module_DATA) $(module1_DATA) $(client_DATA) $(ynclude_DATA) 
$(scrconf_DATA) $(agent_SCRIPTS) $(schemafiles_DATA) $(desktop_DATA)
+EXTRA_DIST = $(module_DATA) $(module1_DATA) $(client_DATA) $(ynclude_DATA) 
$(scrconf_DATA) $(agent_SCRIPTS) $(schemafiles_DATA) $(desktop_DATA) 
$(ylib_DATA)
 
-include $(top_srcdir)/Makefile.am.common
\ No newline at end of file
+include $(top_srcdir)/Makefile.am.common
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/src/include/dns-server/dialog-main.rb 
new/yast2-dns-server-3.1.13/src/include/dns-server/dialog-main.rb
--- old/yast2-dns-server-3.1.11/src/include/dns-server/dialog-main.rb   
2015-02-13 14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/src/include/dns-server/dialog-main.rb   
2015-06-23 10:01:26.000000000 +0200
@@ -4,12 +4,12 @@
 # Package:     Configuration of dns-server
 # Summary:     Data for configuration of dns-server, input and output 
functions.
 # Authors:     Jiri Srain <[email protected]>
-#
-# $Id$
-#
-# Representation of the configuration of dns-server.
-# Input and output routines.
+
+require "ui/srv_status_component"
+
 module Yast
+  # Representation of the configuration of dns-server.
+  # Input and output routines.
   module DnsServerDialogMainInclude
     def initialize_dns_server_dialog_main(include_target)
       textdomain "dns-server"
@@ -39,6 +39,11 @@
       # String defines the initial screen for the expert dialog
       @initial_screen = "start_up"
 
+      @status_component = ::UI::SrvStatusComponent.new(
+             "named",
+             enabled_callback: ->(e) { DnsServer.SetStartService(e) }
+      )
+
       @global_options_add_items = Builtins.sort(
         [
           "additional-from-auth",
@@ -256,71 +261,19 @@
       @dns_server_label = _("DNS Server")
 
       @new_widgets = {
-        "auto_start_up" => CWMServiceStart.CreateAutoStartWidget(
-          {
-            "get_service_auto_start" => fun_ref(
-              DnsServer.method(:GetStartService),
-              "boolean ()"
-            ),
-            "set_service_auto_start" => fun_ref(
-              DnsServer.method(:SetStartService),
-              "void (boolean)"
-            ),
-            # radio button (starting DNS service - option 1)
-            "start_auto_button"      => _(
-              "When &Booting"
-            ),
-            # radio button (starting DNS service - option 2)
-            "start_manual_button"    => _(
-              "&Manually"
-            ),
-            "help"                   => Builtins.sformat(
-              CWMServiceStart.AutoStartHelpTemplate,
-              # part of help text, used to describe radiobuttons (matching 
starting DNS service but without "&")
-              _("When Booting"),
-              # part of help text, used to describe radiobuttons (matching 
starting DNS service but without "&")
-              _("Manually")
-            )
-          }
-        ),
-        "start_stop"    => CWMServiceStart.CreateStartStopWidget(
-          {
-            "service_id"                => "named",
-            # label - service status, informative text
-            "service_running_label"     => _(
-              "DNS server is running."
-            ),
-            # label - service status, informative text
-            "service_not_running_label" => _(
-              "DNS server is not running."
-            ),
-            # push button (DNS service handling)
-            "start_now_button"          => _(
-              "&Start DNS Server Now"
-            ),
-            # push button (DNS service handling)
-            "stop_now_button"           => _(
-              "S&top DNS Server Now"
-            ),
-            "save_now_action"           => fun_ref(
-              method(:SaveAndRestart),
-              "void ()"
-            ),
-            # push button (DNS service handling)
-            "save_now_button"           => _(
-              "Save Settings and Reload DNS Server &Now"
-            ),
-            "help"                      => Builtins.sformat(
-              CWMServiceStart.StartStopHelpTemplate(true),
-              # part of help text, used to describe pusbuttons (matching DNS 
service handling but without "&")
-              _("Start DNS Server Now"),
-              # part of help text, used to describe pusbuttons (matching DNS 
service handling but without "&")
-              _("Stop DNS Server Now"),
-              # part of help text, used to describe pusbuttons (matching DNS 
service handling but without "&")
-              _("Save Settings and Reload DNS Server Now")
-            )
-          }
-        ),
+        "start_up"    => {
+          "widget"        => :custom,
+          "custom_widget" => VBox(),
+          "init"          => fun_ref(
+            method(:InitStartUp),
+            "void (string)"
+          ),
+          "handle"        => fun_ref(
+            method(:HandleStartUp),
+            "symbol (string, map)"
+          ),
+          "help"          => @status_component.help
+        },
         "firewall"      => CWMFirewallInterfaces.CreateOpenFirewallWidget(
           { "services" => ["service:bind"], "display_details" => true }
         ),
@@ -458,13 +411,13 @@
         "start_up"      => {
           # FIXME: new startup
           "contents"        => VBox(
-            "auto_start_up",
+            @status_component.widget,
             VSpacing(),
             "firewall",
-            "use_ldap",
-            VSpacing(),
-            "start_stop",
-            VStretch()
+            VStretch(),
+            Right(
+              PushButton(Id("apply"), _("Apply Changes"))
+            )
           ),
           # Dialog Label - DNS - expert settings
           "caption"         => Ops.add(
@@ -478,9 +431,9 @@
           # FIXME: new startup
           "widget_names"    => DnsServer.ExpertUI ?
             # expert mode
-            ["auto_start_up", "firewall", "use_ldap", "start_stop"] :
+            ["start_up", "firewall"] :
             # simple mode
-            ["auto_start_up", "firewall", "start_stop", "set_icon"]
+            ["start_up", "firewall", "set_icon"]
         },
         "forwarders"    => {
           "contents"        => ExpertForwardersDialog(),
@@ -553,7 +506,11 @@
           "widget_descr"    => @new_widgets
         },
         "zones"         => {
-          "contents"        => ExpertZonesDialog(),
+          "contents"        => VBox(
+            "use_ldap",
+            VSpacing(),
+            ExpertZonesDialog()
+          ),
           # Dialog Label - DNS - expert settings
           "caption"         => Ops.add(
             Ops.add(@dns_server_label, ": "),
@@ -563,98 +520,25 @@
           "tree_item_label" => _(
             "DNS Zones"
           ),
-          "widget_names"    => ["zones"]
+          "widget_names"    => ["use_ldap", "zones"]
         }
       }
 
       @functions = { :abort => fun_ref(method(:confirmAbort), "boolean ()") }
     end
 
-    # Dialog Expert Settings - Start Up
-    # @return [Yast::Term] for Get_ExpertDialog()
-    def ExpertStartUpDialog
-      dialog = Top(
-        VBox(
-          # Frame label (DNS starting)
-          Frame(
-            _("Start-Up"),
-            Left(
-              RadioButtonGroup(
-                Id("dns_server_type"),
-                VBox(
-                  # Radiobutton label
-                  Left(RadioButton(Id(:on), _("Now and When Booting"))),
-                  # Radiobutton label
-                  Left(RadioButton(Id(:off), _("Only Manually"))),
-                  VSpacing(1)
-                )
-              )
-            )
-          ),
-          VSpacing(1),
-          # check box
-          Left(
-            CheckBox(Id("use_ldap"), Opt(:notify), _("&LDAP Support Active"))
-          ),
-          VSpacing(1),
-          # Frame label (stoping starting DNS server)
-          Frame(
-            _("Switch On and Off"),
-            Left(
-              HSquash(
-                VBox(
-                  HBox(
-                    # Current status
-                    Label(_("Current Status: ")),
-                    ReplacePoint(
-                      Id("service_status_rp"),
-                      # service status - label
-                      Label(_("DNS server is running."))
-                    ),
-                    HStretch()
-                  ),
-                  # Pushbutton for starting the DNS server
-                  PushButton(
-                    Id("start_dns_now"),
-                    Opt(:hstretch),
-                    _("&Start DNS Server Now")
-                  ),
-                  # Pushbutton for stopping the DNS server
-                  PushButton(
-                    Id("stop_dns_now"),
-                    Opt(:hstretch),
-                    _("S&top DNS Server Now")
-                  )
-                )
-              )
-            )
-          )
-        )
-      )
-      deep_copy(dialog)
+    def InitStartUp(_key)
+      @status_component.refresh_widget
+      nil
     end
 
-    def UpdateServiceStatusWidget
-      if Mode.config
-        UI.ChangeWidget(Id("start_dns_now"), :Enabled, false)
-        UI.ChangeWidget(Id("stop_dns_now"), :Enabled, false)
-        UI.ReplaceWidget(Id("service_status_rp"), Label(""))
+    def HandleStartUp(_key, event)
+      event_id = event["ID"]
+      if event_id == "apply"
+        SaveAndRestart()
       else
-        status = DnsServer.GetDnsServiceStatus
-        UI.ChangeWidget(Id("start_dns_now"), :Enabled, !status)
-        UI.ChangeWidget(Id("stop_dns_now"), :Enabled, status)
-        UI.ReplaceWidget(
-          Id("service_status_rp"),
-          Label(
-            status ?
-              # service sttus - label
-              _("DNS server is running.") :
-              # service sttus - label
-              _("DNS server is not running.")
-          )
-        )
+        @status_component.handle_input(event_id)
       end
-
       nil
     end
 
@@ -665,78 +549,6 @@
       nil
     end
 
-    # Initialize the tab of the dialog
-    def InitExpertStartUpPage(key)
-      SetDNSSErverIcon()
-      auto_start = DnsServer.GetStartService
-      UI.ChangeWidget(
-        Id("dns_server_type"),
-        :CurrentButton,
-        auto_start ? :on : :off
-      )
-      use_ldap = DnsServer.GetUseLdap
-      UI.ChangeWidget(Id("use_ldap"), :Value, use_ldap)
-      UpdateServiceStatusWidget()
-
-      nil
-    end
-
-    # Store settings of a tab of a dialog
-    def StoreExpertStartUpPage(key, event)
-      event = deep_copy(event)
-      auto_start = UI.QueryWidget(Id("dns_server_type"), :CurrentButton) == :on
-      use_ldap = Convert.to_boolean(UI.QueryWidget(Id("use_ldap"), :Value))
-      DnsServer.SetStartService(auto_start)
-
-      nil
-    end
-
-    # Handle events in a tab of a dialog
-    def HandleExpertStartUpPage(key, event)
-      event = deep_copy(event)
-      ret = Ops.get(event, "ID")
-      if ret == "start_dns_now"
-        status = DnsServer.StartDnsService
-        if !status
-          # error report
-          Report.Error(Message.CannotStartService("named"))
-        else
-          Builtins.sleep(500)
-          UpdateServiceStatusWidget()
-        end
-      elsif ret == "stop_dns_now"
-        status = DnsServer.StopDnsService
-        if !status
-          # error report
-          Report.Error(Message.CannotStopService("named"))
-        else
-          Builtins.sleep(500)
-          UpdateServiceStatusWidget()
-        end
-      elsif ret == "use_ldap"
-        # yes-no popup
-        #      if (! Popup::YesNo (
-        popup = _(
-          "All your changes will be lost. Settings will\n" +
-            "be reread from new data storage.\n" +
-            "Continue?\n"
-        ) #))
-        #      {
-        #          return nil;
-        #      }
-        use_ldap = Convert.to_boolean(UI.QueryWidget(Id("use_ldap"), :Value))
-        successful = DnsServer.SetUseLdap(use_ldap)
-        if successful && !Mode.config
-          DnsServer.InitYapiConfigOptions({ "use_ldap" => use_ldap })
-          # error reported in SetUseLdap
-          DnsServer.LdapInit(true, false)
-          DnsServer.CleanYapiConfigOptions
-        end
-        use_ldap = DnsServer.GetUseLdap
-        UI.ChangeWidget(Id("use_ldap"), :Value, use_ldap)
-      end
-      nil
-    end
     # Dialog Expert Settings - Forwarders
     # @return [Yast::Term] for Get_ExpertDialog()
     def ExpertForwardersDialog
@@ -2329,10 +2141,33 @@
       nil
     end
 
+    # Write settings dialog
+    # @return `abort if aborted and `next otherwise
+    def WriteDialog
+      Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
+      ret = DnsServer.Write
+      if ret
+        @status_component.reload
+        :next
+      else
+        if Popup.YesNo(_("Saving the configuration failed. Change the 
settings?"))
+          :back
+        else
+          :abort
+        end
+      end
+    end
+
+    # Writes settings and restores the dialog without exiting
     def SaveAndRestart
       Wizard.CreateDialog
       Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
-      DnsServer.Write
+      ret = DnsServer.Write
+      if ret
+        @status_component.reload
+      else
+        Report.Error(_("Saving the configuration failed"))
+      end
       Builtins.sleep(1000)
       UI.CloseDialog
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/src/include/dns-server/dialogs.rb 
new/yast2-dns-server-3.1.13/src/include/dns-server/dialogs.rb
--- old/yast2-dns-server-3.1.11/src/include/dns-server/dialogs.rb       
2015-02-13 14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/src/include/dns-server/dialogs.rb       
2015-06-23 10:01:26.000000000 +0200
@@ -59,21 +59,6 @@
       ret ? :next : :abort
     end
 
-    # Write settings dialog
-    # @return `abort if aborted and `next otherwise
-    def WriteDialog
-      Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
-      ret = DnsServer.Write
-      # yes-no popup
-      if !ret &&
-          Popup.YesNo(
-            _("Saving the configuration failed. Change the settings?")
-          )
-        return :back
-      end
-      ret ? :next : :abort
-    end
-
     def runZoneTypeSwitch
       type = Ops.get_string(@current_zone, "type", "master")
       name = Ops.get_string(@current_zone, "zone", "unknown")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/src/include/dns-server/wizards.rb 
new/yast2-dns-server-3.1.13/src/include/dns-server/wizards.rb
--- old/yast2-dns-server-3.1.11/src/include/dns-server/wizards.rb       
2015-02-13 14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/src/include/dns-server/wizards.rb       
2015-06-23 10:01:26.000000000 +0200
@@ -51,6 +51,8 @@
         "forward_zone_tab" => { :abort => :abort, :next => "main" }
       }
 
+      # Do not let DnsServer manage the service status, let the user decide
+      DnsServer.SetWriteOnly(true)
       ret = Sequencer.Run(aliases, sequence)
 
       ret
@@ -96,6 +98,8 @@
         "forward_zone_tab" => { :abort => :abort, :next => "zones" }
       }
 
+      # In wizard mode, the current status and the status at boot are synced
+      DnsServer.SetWriteOnly(false)
       ret = Sequencer.Run(aliases, sequence)
 
       ret
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/src/lib/ui/srv_status_component.rb 
new/yast2-dns-server-3.1.13/src/lib/ui/srv_status_component.rb
--- old/yast2-dns-server-3.1.11/src/lib/ui/srv_status_component.rb      
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-dns-server-3.1.13/src/lib/ui/srv_status_component.rb      
2015-06-23 10:01:26.000000000 +0200
@@ -0,0 +1,232 @@
+# Copyright (c) 2015 SUSE LLC.
+#  All Rights Reserved.
+
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of version 2 or 3 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 Novell about this file by physical or electronic mail,
+#  you may find current contact information at www.suse.com
+
+require "yast"
+Yast.import "Service"
+Yast.import "UI"
+
+module UI
+  # Component encapsulating the widgets for managing the status of services 
(both
+  # currently and on system boot) and the behavior associated to those widgets
+  #
+  # As long as #handle_input is invoked in the event loop, the component will
+  # handle interactive starting and stopping of the service on user demand. In
+  # addition #reload can be used after saving the settings.
+  #
+  # To manage the status on boot, the component can be queried for the user
+  # selection using #enabled?. In addition enabled_callback (in constructor)
+  # can be used to observe the status of the corresponding field in the UI.
+  class SrvStatusComponent
+    include Yast::UIShortcuts
+    include Yast::I18n
+    include Yast::Logger
+
+    # @param service_name [String] name of the service as expected by
+    #   Yast::Service
+    # @param reload [Boolean] initial value for the "reload" checkbox.
+    #   Keep in mind it will always be displayed as unchecked if the service is
+    #   not running, despite the real value.
+    # @param enabled_callback [Proc] callback executed when the "enabled on
+    #   boot" checkbox is changed. The only parameter of the callback is the 
new
+    #   state of the checkbox (boolean).
+    def initialize(service_name, reload: true, enabled_callback: nil)
+      @service_name = service_name
+      @reload = reload
+      @enabled_callback = enabled_callback
+
+      @enabled = service_enabled?
+      @id_prefix = "_srv_status_#{@service_name}"
+      textdomain "base"
+    end
+
+    # @return [YaST::Term]
+    def widget
+      Frame(
+        _("Service Status"),
+        VBox(
+          ReplacePoint(Id("#{id_prefix}_status"), status_widget),
+          reload_widget,
+          VSpacing(),
+          on_boot_widget
+        )
+      )
+    end
+
+    # Handles the input triggered by the widgets, this method must be called in
+    # the event loop of the dialog using the component.
+    def handle_input(input)
+      case input
+      when "#{id_prefix}_stop"
+        stop_service
+        refresh_widget
+      when "#{id_prefix}_start"
+        start_service
+        refresh_widget
+      when "#{id_prefix}_reload"
+        @reload = Yast::UI.QueryWidget(Id(input), :Value)
+      when "#{id_prefix}_enabled"
+        @enabled = Yast::UI.QueryWidget(Id(input), :Value)
+        @enabled_callback.call(@enabled) if @enabled_callback
+      else
+        log.info "Input not handled by SrvStatusComponent: #{input}"
+      end
+    end
+
+    # Updates the widget to reflect the current status of the service and the
+    # settings
+    def refresh_widget
+      Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Enabled, 
service_running?)
+      Yast::UI.ChangeWidget(Id("#{id_prefix}_reload"), :Value, 
service_running? && @reload)
+      Yast::UI.ChangeWidget(Id("#{id_prefix}_enabled"), :Value, @enabled)
+      Yast::UI.ReplaceWidget(Id("#{id_prefix}_status"), status_widget)
+    end
+
+    # Reloads the service only if the user requested so. It should be called
+    # after saving the settings.
+    def reload
+      reload_service if service_running? && @reload
+    end
+
+    # Checks if the user requested the service to be enabled on boot
+    #
+    # @return [Boolean]
+    def enabled?
+      @enabled
+    end
+
+    # Content for the help
+    def help
+      _(
+        "<p><b><big>Current status</big></b><br>\n"\
+        "Displays the current status of the service. The status will remain "\
+        "the same after saving the settings, independently of the value of "\
+        "'start service during boot'.</p>\n"\
+        "<p><b><big>Reload After Saving Settings</big></b><br>\n"\
+        "Only applicable if the service is currently running. "\
+        "Ensures the running service reloads the new configuration after "\
+        "saving it (via 'ok' or 'save' buttons).</p>\n"\
+        "<p><b><big>Start During System Boot</big></b><br>\n"\
+        "Check this field to enable the service at system boot. "\
+        "Un-check it to disable the service. "\
+        "This does not affect the current status of the service in the already 
"\
+        "running system.</p>\n"
+      )
+    end
+
+    protected
+
+    attr_reader :id_prefix
+
+    # Checks if the service is currently running
+    #
+    # Must be redefined for services not following standard procedures
+    #
+    # @return [Boolean]
+    def service_running?
+      Yast::Service.active?(@service_name)
+    end
+
+    # Checks if the service is currently enabled on boot
+    #
+    # Must be redefined for services not following standard procedures
+    #
+    # @return [Boolean]
+    def service_enabled?
+      Yast::Service.enabled?(@service_name)
+    end
+
+    # Starts the service inmediatly
+    #
+    # Must be redefined for services not following standard procedures
+    def start_service
+      log.info "Default implementation of SrvStatusComponent#start_service for 
#{@service_name}"
+      Yast::Service.Start(@service_name)
+    end
+
+    # Stops the service inmediatly
+    #
+    # Must be redefined for services not following standard procedures
+    def stop_service
+      log.info "Default implementation of SrvStatusComponent#stop_service for 
#{@service_name}"
+      Yast::Service.Stop(@service_name)
+    end
+
+    # Reloads the configuration of a running service
+    #
+    # Must be redefined for services not following standard procedures
+    def reload_service
+      log.info "Default implementation of SrvStatusComponent#reload_service 
for #{@service_name}"
+      Yast::Service.Reload(@service_name)
+    end
+
+    # Widget displaying the status and associated buttons
+    def status_widget
+      Left(
+        HBox(
+          Label(_("Current status:")),
+          Label(" "),
+          *label_and_action_widgets
+        )
+      )
+    end
+
+    # Widget to configure the status on boot
+    def on_boot_widget
+      Left(
+        CheckBox(
+          Id("#{id_prefix}_enabled"),
+          Opt(:notify),
+          _("Start During System Boot"),
+          @enabled
+        )
+      )
+    end
+
+    # Widget to configure reloading of the running service
+    def reload_widget
+      opts = [:notify]
+      opts << :disabled unless service_running? 
+      Left(
+        CheckBox(
+          Id("#{id_prefix}_reload"),
+          Opt(*opts),
+          _("Reload After Saving Settings"),
+          service_running? && @reload
+        )
+      )
+    end
+
+    def label_and_action_widgets
+      if service_running?
+        [
+          # TRANSLATORS: status of a service
+          Label(_("running")),
+          Label(" "),
+          PushButton(Id("#{id_prefix}_stop"), _("Stop now"))
+        ]
+      else
+        [
+          # TRANSLATORS: status of a service
+          Label(_("stopped")),
+          Label(" "),
+          PushButton(Id("#{id_prefix}_start"), _("Start now"))
+        ]
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/src/modules/DnsZones.pm 
new/yast2-dns-server-3.1.13/src/modules/DnsZones.pm
--- old/yast2-dns-server-3.1.11/src/modules/DnsZones.pm 2015-02-13 
14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/src/modules/DnsZones.pm 2015-06-23 
10:01:26.000000000 +0200
@@ -162,7 +162,8 @@
 
     my $fqdn = $self->GetFQDN();
     if ($fqdn eq "") {
-       $fqdn = "linux.site";
+        my $tld = $Hostname::DefaultDomain;
+        $fqdn = "linux.$tld";
     }
 
     $fqdn = "$fqdn.";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/src/scrconf/dns_named.scr 
new/yast2-dns-server-3.1.13/src/scrconf/dns_named.scr
--- old/yast2-dns-server-3.1.11/src/scrconf/dns_named.scr       2015-02-13 
14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/src/scrconf/dns_named.scr       2015-06-23 
10:01:26.000000000 +0200
@@ -18,7 +18,7 @@
     `IniAgent( "/etc/named.conf",
        $[
            // join_multiline for multiline values without newlines
-           "options"   : [ "global_values", "repeat_names", "join_multiline" ],
+           "options"   : [ "global_values", "repeat_names", "join_multiline", 
"ignore_case" ],
            "comments"  : [ "^[ \t]*#.*$", "^[ \t]*$" ],
            "params"    : [
                $[
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/test/dns_server_test.rb 
new/yast2-dns-server-3.1.13/test/dns_server_test.rb
--- old/yast2-dns-server-3.1.11/test/dns_server_test.rb 2015-02-13 
14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/test/dns_server_test.rb 2015-06-23 
10:01:26.000000000 +0200
@@ -1,8 +1,6 @@
 #! /usr/bin/env rspec
 
-ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)
-
-require "yast"
+require_relative "test_helper"
 
 Yast.import "DnsServer"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/test/dns_server_ui_test.rb 
new/yast2-dns-server-3.1.13/test/dns_server_ui_test.rb
--- old/yast2-dns-server-3.1.11/test/dns_server_ui_test.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-dns-server-3.1.13/test/dns_server_ui_test.rb      2015-06-23 
10:01:26.000000000 +0200
@@ -0,0 +1,56 @@
+#! /usr/bin/env rspec
+
+require_relative "test_helper"
+
+Yast.import "DnsServerUI"
+
+describe Yast::DnsServerUI do
+  subject { Yast::DnsServerUI }
+
+  # Direct translation to RSpec of equivalent tests from the old testsuite
+  describe "#ChangeIPToLocalEquivalent" do
+    it "transforms private IPv4 addresses" do
+      expect(subject.ChangeIPToLocalEquivalent("192.168.5.1")).to eq 
"127.0.0.1"
+    end
+
+    it "transforms public IPv4 addresses" do
+      expect(subject.ChangeIPToLocalEquivalent("238.11.26.25")).to eq 
"127.0.0.1"
+    end
+
+    it "transforms IPv6 addresses" do
+      expect(subject.ChangeIPToLocalEquivalent("fe80::21c:c0ff:fe18:f01c")).to 
eq "::1"
+    end
+
+    it "returns nil for invalid IPs" do
+      expect(subject.ChangeIPToLocalEquivalent("trash")).to be_nil
+    end
+  end
+
+  # Direct translation to RSpec of equivalent tests from the old testsuite
+  describe "#CurrentlyUsedIPs" do
+    before do
+      allow(Yast::SCR).to receive(:Execute).and_return(
+        "exit"   => 0,
+        "stdout" => "127.0.0.1\n" +
+          "127.0.0.2\n" +
+          "::1\n" +
+          "192.168.5.1\n" +
+          "238.11.26.25\n" +
+          "fe80::21c:c0ff:fe18:f01c",
+        "stderr" => ""
+      )
+    end
+
+    it "excludes local IPs when requested to do so" do
+      expect(subject.CurrentlyUsedIPs(false)).to eq(
+        ["192.168.5.1", "238.11.26.25", "fe80::21c:c0ff:fe18:f01c"]
+      )
+    end
+
+    it "includes local IPs when requested to do so" do
+      expect(subject.CurrentlyUsedIPs(true)).to eq(
+        ["127.0.0.1", "127.0.0.2", "::1", "192.168.5.1", "238.11.26.25", 
"fe80::21c:c0ff:fe18:f01c"]
+      )
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/test/srv_status_component_test.rb 
new/yast2-dns-server-3.1.13/test/srv_status_component_test.rb
--- old/yast2-dns-server-3.1.11/test/srv_status_component_test.rb       
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-dns-server-3.1.13/test/srv_status_component_test.rb       
2015-06-23 10:01:26.000000000 +0200
@@ -0,0 +1,147 @@
+#! /usr/bin/env rspec
+
+require_relative "test_helper"
+require "ui/srv_status_component"
+
+# Some helpers to test the UI
+
+def matches_id_and_text?(widget, id, text)
+  return false unless widget.is_a?(Yast::Term)
+  return false unless widget.params
+  return false unless widget.params.any? do |p|
+    p.is_a?(Yast::Term) && p.value == :id && p.params.first =~ id
+  end
+  return widget.params.any? {|p| p.is_a?(::String) && p =~ text }
+end
+
+def widget_by_id_and_text(widgets, id, text)
+  widgets.nested_find do |t|
+    matches_id_and_text?(t, /#{id}/, /#{Yast::_(text)}/)
+  end
+end
+
+def options_for(term)
+  opt = term.params.find do |p|
+    p.is_a?(Yast::Term) && p.value == :opt
+  end
+  opt.params
+end
+
+def id_for(term)
+  id = term.params.find do |p|
+    p.is_a?(Yast::Term) && p.value == :id
+  end
+  id.params.first
+end
+
+# Class using SrvStatusComponent
+class DummyDialog
+  include Yast::UIShortcuts
+
+  attr_reader :enabled1, :enabled2, :srv1_component, :srv2_component
+
+  def initialize
+    @srv1_component = ::UI::SrvStatusComponent.new(
+      "service1",
+      enabled_callback: ->(e) { @enabled1 = e }
+    )
+    @srv2_component = ::UI::SrvStatusComponent.new("service2")
+    @enabled1 = @srv1_component.enabled?
+    @enabled2 = @srv2_component.enabled?
+  end
+
+  def handle_input(input)
+    @srv1_component.handle_input(input)
+    @srv2_component.handle_input(input)
+  end
+
+  def content
+    VBox(
+      Heading("Dummy dialog"),
+      @srv1_component.widget,
+      @srv2_component.widget,
+      PushButton(Id(:ok), "Ok")
+    )
+  end
+end
+  
+module Yast
+  extend Yast::I18n
+  Yast::textdomain "base"
+
+  import "Service"
+  import "UI"
+  
+  describe ::UI::SrvStatusComponent do
+    before do
+      allow(Yast::Service).to receive(:enabled?).with("service1").and_return 
true
+      allow(Yast::Service).to receive(:enabled?).with("service2").and_return 
false
+      allow(Yast::Service).to receive(:active?).with("service1").and_return 
true
+      allow(Yast::Service).to receive(:active?).with("service2").and_return 
false
+    end
+
+    let(:dialog) { DummyDialog.new }
+    let(:widgets) { dialog.content }
+    let(:stop_service1) { widget_by_id_and_text(widgets, "service1", "Stop 
now") }
+    let(:start_service2) { widget_by_id_and_text(widgets, "service2", "Start 
now") }
+    let(:reload_service1) { widget_by_id_and_text(widgets, "service1", "Reload 
After Saving Settings") }
+    let(:reload_service2) { widget_by_id_and_text(widgets, "service2", "Reload 
After Saving Settings") }
+    let(:enabled_service1) { widget_by_id_and_text(widgets, "service1", "Start 
During System Boot") }
+    let(:enabled_service2) { widget_by_id_and_text(widgets, "service2", "Start 
During System Boot") }
+
+    describe "#initialize" do
+      it "reads the initial enabled state from the system" do
+        expect(dialog.enabled1).to eq true
+        expect(dialog.enabled2).to eq false
+      end
+    end
+
+    describe "#widget" do
+      it "includes all the UI elements" do
+        expect(stop_service1).not_to be_nil
+        expect(start_service2).not_to be_nil
+        expect(reload_service1).not_to be_nil
+        expect(reload_service2).not_to be_nil
+        expect(enabled_service1).not_to be_nil
+        expect(enabled_service2).not_to be_nil
+      end
+
+      it "disables and unchecks the reload button for stopped services" do
+        expect(options_for(reload_service2).any? {|p| p == :disabled })
+        expect(reload_service2.params.last).to eq false
+      end
+
+      it "enables the reload button for stopped services" do
+        expect(options_for(reload_service1).none? {|p| p == :disabled })
+      end
+    end
+
+    describe "#handle_input" do
+      it "stops the service on user request" do
+        expect(Yast::Service).to receive(:Stop).with("service1")
+        dialog.handle_input(id_for(stop_service1))
+      end
+
+      it "starts the service on user request" do
+        expect(Yast::Service).to receive(:Start).with("service2")
+        dialog.handle_input(id_for(start_service2))
+      end
+
+      it "triggers 'enabled_callback' if available" do
+        allow(Yast::UI).to receive(:QueryWidget).and_return "new_value"
+        dialog.handle_input(id_for(enabled_service1))
+
+        expect(dialog.enabled1).to eq "new_value"
+      end
+
+      it "changes the result of #enabled? on user request" do
+        expect(dialog.srv1_component.enabled?).to eq true
+
+        allow(Yast::UI).to receive(:QueryWidget).and_return false
+        dialog.handle_input(id_for(enabled_service1))
+
+        expect(dialog.srv1_component.enabled?).to eq false
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dns-server-3.1.11/test/test_helper.rb 
new/yast2-dns-server-3.1.13/test/test_helper.rb
--- old/yast2-dns-server-3.1.11/test/test_helper.rb     1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-dns-server-3.1.13/test/test_helper.rb     2015-06-23 
10:01:26.000000000 +0200
@@ -0,0 +1,40 @@
+# Copyright (c) 2014 SUSE LLC.
+#  All Rights Reserved.
+
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of version 2 or 3 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 Novell about this file by physical or electronic mail,
+#  you may find current contact information at www.suse.com
+
+# Set the paths
+SRC_PATH = File.expand_path("../../src", __FILE__)
+ENV["Y2DIR"] = SRC_PATH
+
+require "yast"
+
+if ENV["COVERAGE"]
+  require "simplecov"
+  SimpleCov.start
+
+  # for coverage we need to load all ruby files
+  Dir["#{SRC_PATH}/{lib,modules}/**/*.rb"].each { |f| require_relative f }
+
+  # use coveralls for on-line code coverage reporting at Travis CI
+  if ENV["TRAVIS"]
+    require "coveralls"
+    SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+      SimpleCov::Formatter::HTMLFormatter,
+      Coveralls::SimpleCov::Formatter
+    ]
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/testsuite/tests/DnsServerUI.out 
new/yast2-dns-server-3.1.13/testsuite/tests/DnsServerUI.out
--- old/yast2-dns-server-3.1.11/testsuite/tests/DnsServerUI.out 2015-02-13 
14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/testsuite/tests/DnsServerUI.out 1970-01-01 
01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-Dump   ==========================================================
-Return 127.0.0.1
-Return 127.0.0.1
-Return ::1
-Return nil
-Dump   ==========================================================
-Return ["127.0.0.1", "127.0.0.2", "::1", "192.168.5.1", "238.11.26.25", 
"fe80::21c:c0ff:fe18:f01c"]
-Return ["192.168.5.1", "238.11.26.25", "fe80::21c:c0ff:fe18:f01c"]
-Dump   ==========================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dns-server-3.1.11/testsuite/tests/DnsServerUI.rb 
new/yast2-dns-server-3.1.13/testsuite/tests/DnsServerUI.rb
--- old/yast2-dns-server-3.1.11/testsuite/tests/DnsServerUI.rb  2015-02-13 
14:26:11.000000000 +0100
+++ new/yast2-dns-server-3.1.13/testsuite/tests/DnsServerUI.rb  1970-01-01 
01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
-# encoding: utf-8
-require "yast"
-
-module Yast
-  class DnsServerUIClient < Client
-    def main
-      # testedfiles: DnsServerUI
-
-      # While running tests, variable Y2ALLGLOBAL makes all functions global
-      # thus we can test all internal functions
-
-      Yast.include self, "testsuite.rb"
-
-      Yast.import "DnsServerUI"
-
-      # DnsServerUI::ChangeIPToLocalEquivalent
-      DUMP("==========================================================")
-
-      @ips = [
-        "192.168.5.1",
-        "238.11.26.25",
-        "fe80::21c:c0ff:fe18:f01c",
-        "trash"
-      ]
-
-      Builtins.foreach(@ips) { |ip| TEST(lambda do
-        DnsServerUI.ChangeIPToLocalEquivalent(ip)
-      end, [], nil) }
-
-      DUMP("==========================================================")
-
-      @READ = {}
-      @WRITE = {}
-      @EXEC = {
-        "target" => {
-          "bash_output" => {
-            "exit"   => 0,
-            "stdout" => "127.0.0.1\n" +
-              "127.0.0.2\n" +
-              "::1\n" +
-              "192.168.5.1\n" +
-              "238.11.26.25\n" +
-              "fe80::21c:c0ff:fe18:f01c",
-            "stderr" => ""
-          }
-        }
-      }
-
-      # DnsServerUI::CurrentlyUsedIPs
-      TEST(lambda { DnsServerUI.CurrentlyUsedIPs(true) }, [@READ, @WRITE, 
@EXEC], nil)
-      TEST(lambda { DnsServerUI.CurrentlyUsedIPs(false) }, [@READ, @WRITE, 
@EXEC], nil)
-
-      DUMP("==========================================================")
-
-      nil
-    end
-  end
-end
-
-Yast::DnsServerUIClient.new.main


Reply via email to