Hello community, here is the log from the commit of package yast2-inetd for openSUSE:Factory checked in at 2014-08-20 17:52:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-inetd (Old) and /work/SRC/openSUSE:Factory/.yast2-inetd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-inetd" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-inetd/yast2-inetd.changes 2014-05-06 13:40:45.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-inetd.new/yast2-inetd.changes 2014-08-20 17:52:50.000000000 +0200 @@ -1,0 +2,6 @@ +Fri Aug 15 15:43:33 CEST 2014 - [email protected] + +- Fixed adjusting the xinetd service status (bnc#886420) +- 3.1.6 + +------------------------------------------------------------------- Old: ---- yast2-inetd-3.1.5.tar.bz2 New: ---- yast2-inetd-3.1.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-inetd.spec ++++++ --- /var/tmp/diff_new_pack.0VB4Hj/_old 2014-08-20 17:52:52.000000000 +0200 +++ /var/tmp/diff_new_pack.0VB4Hj/_new 2014-08-20 17:52:52.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-inetd -Version: 3.1.5 +Version: 3.1.6 Release: 0 Url: https://github.com/yast/yast-inetd @@ -26,9 +26,11 @@ # yast2-2.23.15 - Service module switched to systemd BuildRequires: perl-XML-Writer +BuildRequires: rubygem-rspec BuildRequires: update-desktop-files BuildRequires: yast2 >= 2.23.15 BuildRequires: yast2-devtools >= 3.1.10 +BuildRequires: yast2-ruby-bindings BuildRequires: yast2-testsuite BuildRequires: yast2-users # Wizard::SetDialogTitleAndIcon ++++++ yast2-inetd-3.1.5.tar.bz2 -> yast2-inetd-3.1.6.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/package/yast2-inetd.changes new/yast2-inetd-3.1.6/package/yast2-inetd.changes --- old/yast2-inetd-3.1.5/package/yast2-inetd.changes 2014-05-05 13:49:49.000000000 +0200 +++ new/yast2-inetd-3.1.6/package/yast2-inetd.changes 2014-08-15 16:34:09.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Aug 15 15:43:33 CEST 2014 - [email protected] + +- Fixed adjusting the xinetd service status (bnc#886420) +- 3.1.6 + +------------------------------------------------------------------- Mon May 5 13:21:51 CEST 2014 - [email protected] - Replaced obsolete Service.* calls with new ones diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/package/yast2-inetd.spec new/yast2-inetd-3.1.6/package/yast2-inetd.spec --- old/yast2-inetd-3.1.5/package/yast2-inetd.spec 2014-05-05 13:49:49.000000000 +0200 +++ new/yast2-inetd-3.1.6/package/yast2-inetd.spec 2014-08-15 16:34:09.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-inetd -Version: 3.1.5 +Version: 3.1.6 Release: 0 Url: https://github.com/yast/yast-inetd @@ -30,6 +30,8 @@ BuildRequires: yast2 >= 2.23.15 BuildRequires: yast2-users perl-XML-Writer update-desktop-files yast2-testsuite BuildRequires: yast2-devtools >= 3.1.10 +BuildRequires: yast2-ruby-bindings +BuildRequires: rubygem-rspec # Wizard::SetDialogTitleAndIcon Requires: yast2 >= 2.21.22 Requires: yast2-packager yast2-users diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/src/include/inetd/dialogs.rb new/yast2-inetd-3.1.6/src/include/inetd/dialogs.rb --- old/yast2-inetd-3.1.5/src/include/inetd/dialogs.rb 2014-05-05 13:49:49.000000000 +0200 +++ new/yast2-inetd-3.1.6/src/include/inetd/dialogs.rb 2014-08-15 16:34:09.000000000 +0200 @@ -28,8 +28,12 @@ # Martin Lazar <[email protected]> # # $Id$ +require "yast" + module Yast module InetdDialogsInclude + include Yast::Logger + def initialize_inetd_dialogs(include_target) Yast.import "UI" @@ -329,12 +333,11 @@ VSpacing(0.5), Left( RadioButtonGroup( + Id(:enable_disable_inetd), VBox( # Translators: Initial and target state of xinetd (or inetd) - Left(RadioButton(Id(:stop), Opt(:notify), _("D&isable"), true)), - Left( - RadioButton(Id(:editable), Opt(:notify), _("Enab&le"), false) - ) + Left(RadioButton(Id(:disable), Opt(:notify), _("D&isable"))), + Left(RadioButton(Id(:enable), Opt(:notify), _("Enab&le"))) ) ) ), @@ -427,7 +430,8 @@ # if service active, enable editting new_state = Inetd.netd_status - UI.ChangeWidget(Id(:editable), :Value, new_state) + + UI.ChangeWidget(Id(:enable_disable_inetd), :CurrentButton, new_state ? :enable : :disable) UI.ChangeWidget(Id(:table), :Enabled, new_state) UI.ChangeWidget(Id(:create), :Enabled, new_state) UI.ChangeWidget(Id(:delete), :Enabled, new_state) @@ -449,18 +453,20 @@ # AARGH unused. need_rebuild = true - if Convert.to_boolean(UI.QueryWidget(Id(:editable), :Value)) + if Inetd.netd_status UI.SetFocus(Id(:table)) else - UI.SetFocus(Id(:stop)) + UI.SetFocus(Id(:enable)) end ret = UI.UserInput - Builtins.y2milestone("ret %1", ret) + log.info "User ret: #{ret}" + ret = :abort if ret == :cancel # window-close button - if ret == :editable || ret == :stop - new_state2 = Convert.to_boolean(UI.QueryWidget(Id(:editable), :Value)) + if [:enable, :disable].include?(ret) + new_state2 = UI.QueryWidget(Id(:enable_disable_inetd), :CurrentButton) == :enable + UI.ChangeWidget(Id(:table), :Enabled, new_state2) UI.ChangeWidget(Id(:create), :Enabled, new_state2) UI.ChangeWidget(Id(:delete), :Enabled, new_state2) @@ -779,9 +785,7 @@ Inetd.netd_status = false # Translators: Popup::Warning Popup.Warning( - _( - "All services are marked as disabled (locked).\nInternet super-server will be disabled." - ) + _("All services are marked as disabled (locked).\nInternet super-server will be disabled.") ) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/src/modules/Inetd.rb new/yast2-inetd-3.1.6/src/modules/Inetd.rb --- old/yast2-inetd-3.1.5/src/modules/Inetd.rb 2014-05-05 13:49:49.000000000 +0200 +++ new/yast2-inetd-3.1.6/src/modules/Inetd.rb 2014-08-15 16:34:09.000000000 +0200 @@ -35,6 +35,10 @@ module Yast class InetdClass < Module + include Yast::Logger + + SERVICE_NAME = "xinetd" + def main Yast.import "UI" textdomain "inetd" @@ -158,7 +162,6 @@ # Is xinetd running? # These variables contains return values from Service::Status() calls. @netd_status = false - @netd_status_read = @netd_status # This variable is used for new iid "generator" @last_created = 0 @@ -205,8 +208,7 @@ :to => "list <map <string, any>>" ) - @netd_status = Service.active?("xinetd") - @netd_status_read = @netd_status + @netd_status = Service.active?(SERVICE_NAME) return false if Abort() ProgressNextStage(_("Finished")) @@ -282,9 +284,6 @@ return false if Abort() if @write_only - # enable/disable the current service - @netd_status ? Service.enable("xinetd") : Service.disable("xinetd") - # YUCK, looks like autoinst part, should be done in inetd_auto.ycp new_conf = [] new_conf = Convert.convert( @@ -293,43 +292,10 @@ :to => "list <map <string, any>>" ) @netd_conf = mergeAfterInstall(new_conf, @netd_conf) - SCR.Write(path(".etc.xinetd_conf.services"), @netd_conf) - else - SCR.Write(path(".etc.xinetd_conf.services"), @netd_conf) - - if @netd_status - if !@netd_status_read - Builtins.y2milestone( - "%1 was running --- stoping and disabling service", - "xinetd" - ) - Service.Stop("xinetd") unless @write_only - Service.Disable("xinetd") - else - Builtins.y2milestone( - "%1 was stopped --- leaving unchanged", - "xinetd" - ) - end - else - # current is running - only reload - if @netd_status_read - Builtins.y2milestone( - "%1 was running --- calling reload", - "xinetd" - ) - Service.reload("xinetd") unless @write_only - else - Builtins.y2milestone( - "%1 was stopped --- enabling and starting service", - "xinetd" - ) - Service.Start("xinetd") unless @write_only - Service.Enable("xinetd") - end - end end + SCR.Write(path(".etc.xinetd_conf.services"), @netd_conf) + adjust_xinetd_service Builtins.y2milestone("Writing done\n") @@ -344,6 +310,31 @@ true end + # Starts or stops and enables or disables the xinetd service + # depending on the current and requested service state + def adjust_xinetd_service + current_status = Service.active?(SERVICE_NAME) + + if @netd_status + if current_status + log.info "#{SERVICE_NAME} was running -> calling reload" + Service.reload(SERVICE_NAME) unless @write_only + else + log.info "#{SERVICE_NAME} was stopped -> enabling and starting service" + Service.Start(SERVICE_NAME) unless @write_only + end + Service.Enable(SERVICE_NAME) + else + if current_status + log.info "#{SERVICE_NAME} was running -> stoping and disabling service" + Service.Stop(SERVICE_NAME) unless @write_only + else + log.info "#{SERVICE_NAME} was stopped -> leaving unchanged" + end + Service.Disable(SERVICE_NAME) + end + end + # Only Write settings # @return [Boolean] True on success def WriteOnly @@ -619,10 +610,8 @@ _S = Summary.AddLine(_S, Summary.NotConfigured) else # Translators: Summary head, if something configured - head = Builtins.sformat( - _("Network services are managed via %1"), - "xinetd" - ) + head = Builtins.sformat(_("Network services are managed via %1"), SERVICE_NAME) + _S = Summary.AddHeader(_S, head) _S = Summary.AddHeader(_S, _("These services will be enabled")) _S = Builtins.sformat("%1<ul>%2</ul></p>", _S, mkeServiceSummary) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/test/Makefile.am new/yast2-inetd-3.1.6/test/Makefile.am --- old/yast2-inetd-3.1.5/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-inetd-3.1.6/test/Makefile.am 2014-08-15 16:34:09.000000000 +0200 @@ -0,0 +1,7 @@ +TESTS = \ + inetd_test.rb + +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = rspec +VERBOSE = 1 +EXTRA_DIST = $(TESTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/test/inetd_test.rb new/yast2-inetd-3.1.6/test/inetd_test.rb --- old/yast2-inetd-3.1.5/test/inetd_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-inetd-3.1.6/test/inetd_test.rb 2014-08-15 16:34:09.000000000 +0200 @@ -0,0 +1,58 @@ +#! /usr/bin/env rspec + +require_relative "./test_helper" + +Yast.import "Inetd" +Yast.import "Service" + +describe Yast::Inetd do + describe "#adjust_xinetd_service" do + context "while service was already running" do + before(:each) do + expect(Yast::Service).to receive(:active?).and_return(true) + end + + context "service should be started" do + it "reloads and enables the service" do + expect(Yast::Service).to receive(:reload).and_return(true) + expect(Yast::Service).to receive(:Enable).and_return(true) + Yast::Inetd.netd_status = true + Yast::Inetd.adjust_xinetd_service + end + end + + context "service should be stopped" do + it "stops and disables the service" do + expect(Yast::Service).to receive(:Stop).and_return(true) + expect(Yast::Service).to receive(:Disable).and_return(true) + Yast::Inetd.netd_status = false + Yast::Inetd.adjust_xinetd_service + end + end + end + + context "while service was not running" do + before(:each) do + expect(Yast::Service).to receive(:active?).and_return(false) + end + + context "service should be started" do + it "starts and enables the service" do + expect(Yast::Service).to receive(:Start).and_return(true) + expect(Yast::Service).to receive(:Enable).and_return(true) + Yast::Inetd.netd_status = true + Yast::Inetd.adjust_xinetd_service + end + end + + context "service should be stopped" do + it "disables the service" do + expect(Yast::Service).not_to receive(:Stop) + expect(Yast::Service).to receive(:Disable).and_return(true) + Yast::Inetd.netd_status = false + Yast::Inetd.adjust_xinetd_service + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-inetd-3.1.5/test/test_helper.rb new/yast2-inetd-3.1.6/test/test_helper.rb --- old/yast2-inetd-3.1.5/test/test_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-inetd-3.1.6/test/test_helper.rb 2014-08-15 16:34:09.000000000 +0200 @@ -0,0 +1,8 @@ +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) + +if ENV["COVERAGE"] + require "simplecov" + SimpleCov.start +end + +require "yast" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
