Hello community,

here is the log from the commit of package yast2-dhcp-server for 
openSUSE:Factory checked in at 2016-01-08 15:23:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-dhcp-server (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-dhcp-server.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-dhcp-server"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-dhcp-server/yast2-dhcp-server.changes      
2015-12-03 13:30:48.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-dhcp-server.new/yast2-dhcp-server.changes 
2016-01-08 15:24:02.000000000 +0100
@@ -1,0 +2,6 @@
+Thu Jan  7 16:29:01 UTC 2016 - an...@suse.com
+
+- Fixed crash when dhcp-server is not installed (bsc#959730)
+- 3.1.8
+
+-------------------------------------------------------------------

Old:
----
  yast2-dhcp-server-3.1.7.tar.bz2

New:
----
  yast2-dhcp-server-3.1.8.tar.bz2

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

Other differences:
------------------
++++++ yast2-dhcp-server.spec ++++++
--- /var/tmp/diff_new_pack.2xkaqq/_old  2016-01-08 15:24:03.000000000 +0100
+++ /var/tmp/diff_new_pack.2xkaqq/_new  2016-01-08 15:24:03.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-dhcp-server
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 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-dhcp-server
-Version:        3.1.7
+Version:        3.1.8
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-dhcp-server-3.1.7.tar.bz2 -> yast2-dhcp-server-3.1.8.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.changes 
new/yast2-dhcp-server-3.1.8/package/yast2-dhcp-server.changes
--- old/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.changes       
2015-11-27 14:43:01.000000000 +0100
+++ new/yast2-dhcp-server-3.1.8/package/yast2-dhcp-server.changes       
2016-01-08 10:12:09.000000000 +0100
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Thu Jan  7 16:29:01 UTC 2016 - an...@suse.com
+
+- Fixed crash when dhcp-server is not installed (bsc#959730)
+- 3.1.8
+
+-------------------------------------------------------------------
 Fri Nov 27 09:19:18 UTC 2015 - an...@suse.com
 
 - Adapted to latest changes in UI::ServiceStatus API (fate#318771)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.spec 
new/yast2-dhcp-server-3.1.8/package/yast2-dhcp-server.spec
--- old/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.spec  2015-11-27 
14:43:01.000000000 +0100
+++ new/yast2-dhcp-server-3.1.8/package/yast2-dhcp-server.spec  2016-01-08 
10:12:09.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dhcp-server
-Version:        3.1.7
+Version:        3.1.8
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.7/src/include/dhcp-server/dialogs.rb 
new/yast2-dhcp-server-3.1.8/src/include/dhcp-server/dialogs.rb
--- old/yast2-dhcp-server-3.1.7/src/include/dhcp-server/dialogs.rb      
2015-11-27 14:43:01.000000000 +0100
+++ new/yast2-dhcp-server-3.1.8/src/include/dhcp-server/dialogs.rb      
2016-01-08 10:12:09.000000000 +0100
@@ -17,6 +17,7 @@
 
       Yast.import "Wizard"
       Yast.import "DhcpServer"
+      Yast.import "DhcpServerUI"
       Yast.import "CWM"
 
       Yast.import "Popup"
@@ -46,9 +47,9 @@
       Builtins.y2milestone("Running write dialog")
       Wizard.RestoreHelp(Ops.get(@HELPS, "write", ""))
       ret = DhcpServer.Write
-      if ret && restart?
+      if ret && restart_after_writing?
         # Restart only if it's already running
-        @service.try_restart
+        DhcpServerUI.service.try_restart
       end
       # yes-no popup
       if !ret &&
@@ -70,7 +71,7 @@
       ret = DhcpServer.Write
       if ret
         # Restart only if it's already running
-        @service.try_restart if restart?
+        DhcpServerUI.service.try_restart if restart_after_writing?
       else
         Report.Error(_("Saving the configuration failed"))
       end
@@ -644,14 +645,5 @@
       return :expert if Mode.config
       DhcpServer.IsConfigurationSimple ? :simple : :expert
     end
-
-  private
-
-    # Checks if the service must be restarted after saving
-    # @return [Boolean]
-    def restart?
-      # If ServiceStatus is used, DhcpServer must be set to write-only
-      DhcpServer.GetWriteOnly() && @status_widget && 
@status_widget.reload_flag?
-    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.7/src/include/dhcp-server/widgets.rb 
new/yast2-dhcp-server-3.1.8/src/include/dhcp-server/widgets.rb
--- old/yast2-dhcp-server-3.1.7/src/include/dhcp-server/widgets.rb      
2015-11-27 14:43:01.000000000 +0100
+++ new/yast2-dhcp-server-3.1.8/src/include/dhcp-server/widgets.rb      
2016-01-08 10:12:09.000000000 +0100
@@ -27,10 +27,22 @@
       Yast.import "TablePopup"
       Yast.import "SuSEFirewall"
       Yast.import "Mode"
+      Yast.import "DhcpServerUI"
+    end
 
-      # Init ServiceStatus widget
-      @service = SystemdService.find(DhcpServer.ServiceName())
-      @status_widget = ::UI::ServiceStatus.new(@service, reload_flag_label: 
:restart)
+    # Widget to handle the status of the service
+    #
+    # @return [::UI::ServiceStatus] nil if the service is not found (dhcp 
server
+    #                               not installed)
+    def status_widget
+      return @status_widget unless @status_widget.nil?
+
+      service = DhcpServerUI.service
+      if service
+        @status_widget = ::UI::ServiceStatus.new(service, reload_flag_label: 
:restart)
+      else
+        nil
+      end
     end
 
     # Function for deleting entry from section
@@ -858,7 +870,7 @@
     # Handle function for the ServiceStatus widget
     def handle_service_status(_key, event)
       event_id = event["ID"]
-      if @status_widget.handle_input(event_id) == :enabled_flag
+      if status_widget.handle_input(event_id) == :enabled_flag
         DhcpServer.SetModified
       end
       nil
@@ -868,10 +880,17 @@
     # @param [String] id string widget id
     # @param [Hash] event map event that caused storing process
     def store_service_status(_key, _event)
-      DhcpServer.SetStartService(@status_widget.enabled_flag?)
+      DhcpServer.SetStartService(status_widget.enabled_flag?)
       nil
     end
 
+    # Checks if the service must be restarted after saving
+    # @return [Boolean]
+    def restart_after_writing?
+      # If ServiceStatus is used, DhcpServer must be set to write-only
+      DhcpServer.GetWriteOnly() && status_widget && status_widget.reload_flag?
+    end
+
     # Initialize widgets
     # Create description map and copy it into appropriate variable of the
     #  DhcpServer module
@@ -1012,8 +1031,8 @@
         },
         "service_status"         => {
           "widget" => :custom,
-          "custom_widget" => @status_widget.widget,
-          "help"   => @status_widget.help,
+          "custom_widget" => status_widget.widget,
+          "help"   => status_widget.help,
           "init"   => fun_ref(method(:init_service_status), "void (string)"),
           "handle" => fun_ref(method(:handle_service_status), "symbol (string, 
map)"),
           "store"  => fun_ref(method(:store_service_status), "void (string, 
map)")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dhcp-server-3.1.7/src/modules/DhcpServerUI.rb 
new/yast2-dhcp-server-3.1.8/src/modules/DhcpServerUI.rb
--- old/yast2-dhcp-server-3.1.7/src/modules/DhcpServerUI.rb     2015-11-27 
14:43:01.000000000 +0100
+++ new/yast2-dhcp-server-3.1.8/src/modules/DhcpServerUI.rb     2016-01-08 
10:12:09.000000000 +0100
@@ -24,6 +24,7 @@
       Yast.import "Report"
       Yast.import "Service"
       Yast.import "SuSEFirewall"
+      Yast.import "SystemdService"
 
       @current_entry_type = ""
       @current_entry_id = ""
@@ -81,6 +82,13 @@
       nil
     end
 
+    # Object representing the DHCP service for its usage in the UI code
+    #
+    # @return [Yast::SystemdServiceClass::Service]
+    def service
+      @service ||= SystemdService.find(DhcpServer.ServiceName())
+    end
+
     publish :variable => :current_entry_type, :type => "string"
     publish :variable => :current_entry_id, :type => "string"
     publish :variable => :current_entry_options, :type => "list <map <string, 
string>>"


Reply via email to