Hello community,

here is the log from the commit of package yast2-tftp-server for 
openSUSE:Factory checked in at 2018-02-02 22:23:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-tftp-server (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-tftp-server.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-tftp-server"

Fri Feb  2 22:23:39 2018 rev:30 rq:572101 version:4.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-tftp-server/yast2-tftp-server.changes      
2016-06-13 21:55:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-tftp-server.new/yast2-tftp-server.changes 
2018-02-02 22:23:43.437837247 +0100
@@ -1,0 +2,7 @@
+Fri Feb  2 14:24:30 UTC 2018 - jreidin...@suse.com
+
+- switch from xinetd to systemd socket activation (fate#323373)
+- switch from SuSEFirewall to firewalld (fate#323460)
+- 4.0.0
+
+-------------------------------------------------------------------

Old:
----
  yast2-tftp-server-3.1.3.tar.bz2

New:
----
  yast2-tftp-server-4.0.0.tar.bz2

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

Other differences:
------------------
++++++ yast2-tftp-server.spec ++++++
--- /var/tmp/diff_new_pack.OnMxhZ/_old  2018-02-02 22:23:44.453789823 +0100
+++ /var/tmp/diff_new_pack.OnMxhZ/_new  2018-02-02 22:23:44.457789636 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-tftp-server
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 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,22 +17,26 @@
 
 
 Name:           yast2-tftp-server
-Version:        3.1.3
+Version:        4.0.0
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        %{name}-%{version}.tar.bz2
 
-BuildRequires:  perl-XML-Writer
+BuildRequires:  augeas-lenses
 BuildRequires:  update-desktop-files
 BuildRequires:  yast2-devtools >= 3.1.10
-BuildRequires:  yast2-testsuite
-# SuSEfirewall2_* scripts merget into one in yast2-2.23.17
-BuildRequires:  yast2 >= 2.23.17
+# SuSEFirewall2 replace by firewalld (fate#323460)
+BuildRequires:  yast2 >= 4.0.39
+BuildRequires:  rubygem(%rb_default_ruby_abi:cfa)
+BuildRequires:  rubygem(%rb_default_ruby_abi:rspec)
+BuildRequires:  rubygem(%rb_default_ruby_abi:yast-rake)
 
-# Wizard::SetDesktopTitleAndIcon
+# SuSEFirewall2 replace by firewalld (fate#323460)
+Requires:       augeas-lenses
 Requires:       lsof
-Requires:       yast2 >= 2.21.22
+Requires:       yast2 >= 4.0.39
+Requires:       rubygem(%rb_default_ruby_abi:cfa)
 
 BuildArch:      noarch
 
@@ -50,11 +54,13 @@
 %prep
 %setup -n %{name}-%{version}
 
+%check
+rake test:unit
+
 %build
-%yast_build
 
 %install
-%yast_install
+rake install DESTDIR="%{buildroot}"
 
 %files
 %defattr(-,root,root)
@@ -62,8 +68,8 @@
 %{yast_yncludedir}/tftp-server/*
 %{yast_clientdir}/tftp-server*.rb
 %{yast_moduledir}/TftpServer.*
+%{yast_libdir}/cfa
 %{yast_desktopdir}/tftp-server.desktop
-%{yast_scrconfdir}/etc_xinetd_d_tftp.scr
 %doc %{yast_docdir}
 
 %changelog

++++++ yast2-tftp-server-3.1.3.tar.bz2 -> yast2-tftp-server-4.0.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/.travis.yml 
new/yast2-tftp-server-4.0.0/.travis.yml
--- old/yast2-tftp-server-3.1.3/.travis.yml     2016-06-09 13:20:08.811784095 
+0200
+++ new/yast2-tftp-server-4.0.0/.travis.yml     2018-02-02 18:19:19.000000000 
+0100
@@ -1,16 +1,11 @@
-language: cpp
-compiler:
-    - gcc
+sudo: required
+language: bash
+services:
+  - docker
+
 before_install:
-    # disable rvm, use system Ruby
-    - rvm reset
-    - wget 
https://raw.githubusercontent.com/yast/yast-devtools/SLE-12-GA/travis-tools/travis_setup.sh
-    - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2" -g 
"yast-rake gettext"
+  - docker build -t yast-tftp-server-image .
 script:
-    - rake check:syntax
-    - rake check:pot
-    - make -f Makefile.cvs
-    - make
-    - sudo make install
-    - make check
-
+  # the "yast-travis-ruby" script is included in the base yastdevel/ruby image
+  # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby
+  - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" 
yast-tftp-server-image yast-travis-ruby
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/CONTRIBUTING.md 
new/yast2-tftp-server-4.0.0/CONTRIBUTING.md
--- old/yast2-tftp-server-3.1.3/CONTRIBUTING.md 2016-06-09 13:20:08.811784095 
+0200
+++ new/yast2-tftp-server-4.0.0/CONTRIBUTING.md 2018-02-02 18:19:19.000000000 
+0100
@@ -3,7 +3,7 @@
 
 YaST is an open source project and as such it welcomes all kinds of
 contributions. If you decide to contribute, please follow these guidelines to
-ensure the process is effective and pleasant both for you and YaST maintainers.
+ensure the process is effective and pleasant both for you and the YaST 
maintainers.
 
 There are two main forms of contribution: reporting bugs and performing code
 changes.
@@ -17,13 +17,11 @@
 
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.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
 guidelines](http://en.opensuse.org/openSUSE:Report_a_YaST_bug).
 
+We can't guarantee that every bug will be fixed, but we'll try.
+
 Code Changes
 ------------
 
@@ -44,15 +42,22 @@
      to the [Ruby style
      guide](https://github.com/SUSE/style-guides/blob/master/Ruby.md).
 
-  4. Make sure your change didn't break anything by building the RPM package
+  4. Update the package version (in `packages/*.spec`, usually by
+     `rake version:bump`) and add a new entry to the `package/*.changes` file
+     (by `osc vc package`).  
+     For bigger changes or changes which need longer discussion it is advised 
to
+     add this as a separate last commit so it can be easily updated when 
another
+     change is merged in the meantime.
+
+  5. Make sure your change didn't break anything by building the RPM package
      (`rake osc:build`). The build process includes running the full testsuite.
 
-  5. Publish the branch and create a pull request.
+  6. Publish the branch and create a pull request.
 
-  6. YaST developers will review your change and possibly point out issues.
+  7. YaST developers will review your change and possibly point out issues.
      Adapt the code under their guidance until they are all resolved.
 
-  7. Finally, the pull request will get merged or rejected.
+  8. Finally, the pull request will get merged or rejected.
 
 See also [GitHub's guide on
 contributing](https://help.github.com/articles/fork-a-repo).
@@ -60,9 +65,6 @@
 If you want to do multiple unrelated changes, use separate branches and pull
 requests.
 
-Do not change the `VERSION` and `*.changes` files as this could lead to
-conflicts.
-
 ### Commits
 
 Each commit in the pull request should do only one thing, which is clearly
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/Dockerfile 
new/yast2-tftp-server-4.0.0/Dockerfile
--- old/yast2-tftp-server-3.1.3/Dockerfile      1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-tftp-server-4.0.0/Dockerfile      2018-02-02 18:19:19.000000000 
+0100
@@ -0,0 +1,3 @@
+FROM yastdevel/ruby
+COPY . /usr/src/app
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/Makefile.cvs 
new/yast2-tftp-server-4.0.0/Makefile.cvs
--- old/yast2-tftp-server-3.1.3/Makefile.cvs    2016-06-09 13:20:08.811784095 
+0200
+++ new/yast2-tftp-server-4.0.0/Makefile.cvs    1970-01-01 01:00:00.000000000 
+0100
@@ -1,22 +0,0 @@
-#
-# Makefile.cvs
-#
-PREFIX = /usr
-
-LIB = $(shell y2tool get-lib)
-
-configure: all
-       ./configure --prefix=$(PREFIX) --libdir=$(PREFIX)/$(LIB)
-
-all:
-       y2tool y2autoconf
-       y2tool y2automake
-       autoreconf --force --install
-
-install: configure
-       make
-       make install
-
-reconf: all
-       ./config.status --recheck
-       ./config.status
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/configure.in.in 
new/yast2-tftp-server-4.0.0/configure.in.in
--- old/yast2-tftp-server-3.1.3/configure.in.in 2016-06-09 13:20:08.815784095 
+0200
+++ new/yast2-tftp-server-4.0.0/configure.in.in 1970-01-01 01:00:00.000000000 
+0100
@@ -1,12 +0,0 @@
-## YCP module configure.in.in
-
-## Initialize
-@YAST2-INIT-COMMON@
-@YAST2-INIT-YCP@
-
-## some common checks
-@YAST2-CHECKS-COMMON@
-@YAST2-CHECKS-YCP@
-
-## and generate the output...
-@YAST2-OUTPUT@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/package/yast2-tftp-server.changes 
new/yast2-tftp-server-4.0.0/package/yast2-tftp-server.changes
--- old/yast2-tftp-server-3.1.3/package/yast2-tftp-server.changes       
2016-06-09 13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/package/yast2-tftp-server.changes       
2018-02-02 18:19:19.000000000 +0100
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Fri Feb  2 14:24:30 UTC 2018 - jreidin...@suse.com
+
+- switch from xinetd to systemd socket activation (fate#323373)
+- switch from SuSEFirewall to firewalld (fate#323460)
+- 4.0.0
+
+-------------------------------------------------------------------
 Thu Jun  9 11:16:24 UTC 2016 - igonzalezs...@suse.com
 
 - Stop generating autodocs (fate#320356)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/package/yast2-tftp-server.spec 
new/yast2-tftp-server-4.0.0/package/yast2-tftp-server.spec
--- old/yast2-tftp-server-3.1.3/package/yast2-tftp-server.spec  2016-06-09 
13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/package/yast2-tftp-server.spec  2018-02-02 
18:19:19.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-tftp-server
-Version:        3.1.3
+Version:        4.0.0
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -26,14 +26,20 @@
 Group:         System/YaST
 License:        GPL-2.0+
 
-BuildRequires: perl-XML-Writer update-desktop-files yast2-testsuite
+BuildRequires: update-desktop-files
 BuildRequires:  yast2-devtools >= 3.1.10
-# SuSEfirewall2_* scripts merget into one in yast2-2.23.17
-BuildRequires: yast2 >= 2.23.17
+BuildRequires: augeas-lenses
+# SuSEFirewall2 replace by firewalld (fate#323460)
+BuildRequires:  yast2 >= 4.0.39
+BuildRequires:  rubygem(%rb_default_ruby_abi:rspec)
+BuildRequires:  rubygem(%rb_default_ruby_abi:yast-rake)
+BuildRequires:  rubygem(%rb_default_ruby_abi:cfa)
 
-# Wizard::SetDesktopTitleAndIcon
-Requires:      yast2 >= 2.21.22
+# SuSEFirewall2 replace by firewalld (fate#323460)
+Requires:       yast2 >= 4.0.39
 Requires:      lsof
+Requires:      augeas-lenses
+Requires:       rubygem(%rb_default_ruby_abi:cfa)
 
 BuildArchitectures:    noarch
 
@@ -49,11 +55,13 @@
 %prep
 %setup -n %{name}-%{version}
 
+%check
+rake test:unit
+
 %build
-%yast_build
 
 %install
-%yast_install
+rake install DESTDIR="%{buildroot}"
 
 
 %files
@@ -62,6 +70,6 @@
 %{yast_yncludedir}/tftp-server/*
 %{yast_clientdir}/tftp-server*.rb
 %{yast_moduledir}/TftpServer.*
+%{yast_libdir}/cfa
 %{yast_desktopdir}/tftp-server.desktop
-%{yast_scrconfdir}/etc_xinetd_d_tftp.scr
 %doc %{yast_docdir}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/src/Makefile.am 
new/yast2-tftp-server-4.0.0/src/Makefile.am
--- old/yast2-tftp-server-3.1.3/src/Makefile.am 2016-06-09 13:20:08.815784095 
+0200
+++ new/yast2-tftp-server-4.0.0/src/Makefile.am 1970-01-01 01:00:00.000000000 
+0100
@@ -1,23 +0,0 @@
-# Sources for tftp-server
-
-module_DATA = \
-  modules/TftpServer.rb
-
-client_DATA = \
-  clients/tftp-server.rb \
-  clients/tftp-server_auto.rb
-
-yncludedir = @yncludedir@/tftp-server
-ynclude_DATA = \
-  include/tftp-server/wizards.rb \
-  include/tftp-server/dialogs.rb
-
-scrconf_DATA = \
-  scrconf/etc_xinetd_d_tftp.scr
-
-desktop_DATA = \
-  desktop/tftp-server.desktop
-
-EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(scrconf_DATA) 
$(desktop_DATA)
-
-include $(top_srcdir)/Makefile.am.common
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/src/include/tftp-server/dialogs.rb 
new/yast2-tftp-server-4.0.0/src/include/tftp-server/dialogs.rb
--- old/yast2-tftp-server-3.1.3/src/include/tftp-server/dialogs.rb      
2016-06-09 13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/src/include/tftp-server/dialogs.rb      
2018-02-02 18:19:19.000000000 +0100
@@ -68,7 +68,7 @@
 
       # firewall widget using CWM
       fw_settings = {
-        "services"        => ["service:tftp"],
+        "services"        => ["tftp"],
         "display_details" => true
       }
       fw_cwm_widget = CWMFirewallInterfaces.CreateOpenFirewallWidget(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/src/lib/cfa/tftp_sysconfig.rb 
new/yast2-tftp-server-4.0.0/src/lib/cfa/tftp_sysconfig.rb
--- old/yast2-tftp-server-3.1.3/src/lib/cfa/tftp_sysconfig.rb   1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-tftp-server-4.0.0/src/lib/cfa/tftp_sysconfig.rb   2018-02-02 
18:19:19.000000000 +0100
@@ -0,0 +1,19 @@
+require "cfa/base_model"
+require "cfa/augeas_parser"
+
+module CFA
+  class TftpSysconfig < BaseModel
+    attributes(
+      user:      "TFTP_USER",
+      directory: "TFTP_DIRECTORY",
+      options:   "TFTP_OPTIONS"
+    )
+
+    PATH = "/etc/sysconfig/tftp".freeze
+
+    def initialize(file_handler: nil)
+      super(AugeasParser.new("sysconfig.lns"), PATH,
+        file_handler: file_handler)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/src/modules/TftpServer.rb 
new/yast2-tftp-server-4.0.0/src/modules/TftpServer.rb
--- old/yast2-tftp-server-3.1.3/src/modules/TftpServer.rb       2016-06-09 
13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/src/modules/TftpServer.rb       2018-02-02 
18:19:19.000000000 +0100
@@ -11,10 +11,18 @@
 # Input and output routines.
 require "yast"
 
+require "shellwords"
+
+require "yast2/target_file" # allow CFA to work on change scr
+require "cfa/tftp_sysconfig"
+require "y2firewall/firewalld"
+
+
 module Yast
   class TftpServerClass < Module
 
-    SERVICE_NAME = "xinetd"
+    SOCKET_NAME = "tftp"
+    PACKAGE_NAME = "tftp"
 
     include Yast::Logger
 
@@ -23,9 +31,9 @@
 
       Yast.import "Progress"
       Yast.import "Report"
-      Yast.import "Service"
+      Yast.import "SystemdSocket"
+      Yast.import "SystemdService"
       Yast.import "Summary"
-      Yast.import "SuSEFirewall"
 
       # Any settings modified?
       # As we have only a single dialog which handles it by itself,
@@ -33,26 +41,35 @@
       @modified = false
 
       # Required packages for operation
-      @required_packages = ["xinetd", "tftp"]
+      @required_packages = [PACKAGE_NAME]
 
-      # Start tftpd via xinetd?
+      # if socket start tftp
       @start = false
 
-      # Image directory, last argument of in.tftpd
-      @directory = ""
-
-      # Other arguments to in.tftpd, ie. not including -s or /dir
-      @other_args = ""
-
+      # sysconfig model
+      @sysconfig = ::CFA::TftpSysconfig.new
+      # sysconfig values we are interested in. Allow to change it with UI.
+      # TODO when doing bigger changes use sysconfig model everywhere
+      @directory = "/srv/tftpboot" # default value
 
       # Detect who is serving tftp:
-      # Inetd may be running, it is the default. But it is ok unless it is
+      # Systemd may be running, it is the default. But it is ok unless it is
       # serving tftp. So we detect who is serving tftp and warn if it is
-      # not xinetd or in.tftpd.
+      # not systemd socket/service or in.tftpd.
       # If nonempty, the user is notified and the module gives up.
       @foreign_servers = ""
     end
 
+    # firewall instance
+    def firewall
+      @firewall ||= Y2Firewall::Firewalld.instance
+    end
+
+    # systemd socket for tftp
+    def socket
+      @socket ||= SystemdSocket.find!(SOCKET_NAME)
+    end
+
     # Returns true if the settings were modified
     # @return settings were modified
     def GetModified
@@ -68,68 +85,32 @@
       nil
     end
 
-    # Extract the directory and other arguments.
-    # global to make testing easier
-    # @param [String] server_args server_args from xinetd.conf
-    def ParseServerArgs(server_args)
-      # extract the last argument and kick "-s".
-      server_args_l = Builtins.filter(Builtins.splitstring(server_args, " 
\t")) do |s|
-        s != ""
-      end
-      sz = Builtins.size(server_args_l)
-      i = 0
-      other_args_l = Builtins.filter(server_args_l) do |s|
-        i = Ops.add(i, 1)
-        s != "-s" && i != sz
-      end
-      @directory = Ops.get(server_args_l, Ops.subtract(sz, 1), "")
-      @other_args = Builtins.mergestring(other_args_l, " ")
-
-      nil
-    end
-
     # Read all tftp-server settings
     # @return true on success
     def Read
       # foreign_servers:
-      # get command names via lsof, filter out xinetd and in.tftpd
+      # get command names via lsof, filter out systemd and in.tftpd
       out = Convert.to_map(
         SCR.Execute(path(".target.bash_output"), "/usr/bin/lsof -i :tftp -Fc")
       )
-      lines = Builtins.splitstring(Ops.get_string(out, "stdout", ""), "\n")
+      lines = Ops.get_string(out, "stdout", "").lines
       # the command is field 'c'
-      lines = Builtins.filter(lines) { |l| Builtins.substring(l, 0, 1) == "c" }
+      lines = lines.select { |l| l.start_with?("c") }
       # strip the c
-      lines = Builtins.maplist(lines) do |l|
-        Builtins.substring(l, 1, Ops.subtract(Builtins.size(l), 1))
-      end
+      lines.map! { |l| l[1..-1].strip }
       # filter out our servers
-      lines = Builtins.filter(lines) { |l| l != "xinetd" && l != "in.tftpd" }
-      @foreign_servers = Builtins.mergestring(lines, ", ")
-
-      xinetd_start = Service.Enabled(SERVICE_NAME)
-
-      # is the config file there at all?
-      sections = SCR.Dir(path(".etc.xinetd_d.tftp.section"))
-      disable = Convert.to_string(
-        SCR.Read(path(".etc.xinetd_d.tftp.value.tftp.disable"))
-      )
-      @start = xinetd_start && sections != [] && disable != "yes"
+      lines.reject! { |l| ["in.tftpd", "systemd"].include?(l) }
+      @foreign_servers = lines.join(", ")
 
-      server_args = Convert.to_string(
-        SCR.Read(path(".etc.xinetd_d.tftp.value.tftp.server_args"))
-      )
-      if server_args == nil
-        # default
-        #      server_args = "-s /tftpboot";
-        server_args = ""
-      end
+      @sysconfig.load
+      @directory = @sysconfig.directory
 
-      ParseServerArgs(server_args)
+      # force find of socket. It can happen if we need to install package first
+      @start = socket.enabled?
 
       # TODO only when we have our own Progress
       #boolean progress_orig = Progress::set (false);
-      SuSEFirewall.Read
+      firewall.read
       #Progress::set (progress_orig);
 
       true
@@ -143,7 +124,7 @@
       # %1 is a command name (or a comma (, ) separated list of them)
       Builtins.sformat(
         _(
-          "This module can only use xinetd to set up TFTP.\n" +
+          "This module can only use systemd socket to set up TFTP.\n" +
             "However, another program is serving TFTP: %1.\n" +
             "Exiting.\n"
         ),
@@ -163,50 +144,27 @@
         return false
       end
 
-      # write the config file
-      #
-      #  create it if it does not exist
-      #  could be a normal situation at initial setup
-      #  or a broken setup, ok if we fix it when writing
-      #  but that means messing up with other parameters
-      #  lets touch just the basics
-      #  the first "item" is the brace following the section start
-      SCR.Write(path(".etc.xinetd_d.tftp.value.tftp.\"{\""), "")
-      SCR.Write(path(".etc.xinetd_d.tftp.value_type.tftp.\"{\""), 1)
-      SCR.Write(
-        path(".etc.xinetd_d.tftp.value.tftp.disable"),
-        @start ? "no" : "yes"
-      )
-      if @start
-        SCR.Write(path(".etc.xinetd_d.tftp.value.tftp.socket_type"), "dgram")
-        SCR.Write(path(".etc.xinetd_d.tftp.value.tftp.protocol"), "udp")
-        SCR.Write(path(".etc.xinetd_d.tftp.value.tftp.wait"), "yes")
-        SCR.Write(path(".etc.xinetd_d.tftp.value.tftp.user"), "root")
-        SCR.Write(
-          path(".etc.xinetd_d.tftp.value.tftp.server"),
-          "/usr/sbin/in.tftpd"
-        )
-        server_args = Builtins.sformat("%1 -s %2", @other_args, @directory)
-        SCR.Write(
-          path(".etc.xinetd_d.tftp.value.tftp.server_args"),
-          server_args
-        )
-      end
+      @sysconfig.directory = @directory
+      @sysconfig.save
 
-      # flush
-      SCR.Write(path(".etc.xinetd_d.tftp"), nil)
 
       # image dir: if does not exist, create with root:root rwxr-xr-x
       SCR.Execute(path(".target.mkdir"), @directory)
+      # and then switch to user which is used for tftp service
+      SCR.Execute(path(".target.bash_output"), "/usr/bin/chown 
#{@sysconfig.user}: #{Shellwords.escape(@directory)}")
 
-      # firewall??
-
-      # enable and (re)start xinetd
-      Service.Enable(SERVICE_NAME) if @start
+      # enable and (re)start systemd socket
+      if @start
+        socket.enable
+        socket.start
+      else
+        socket.disable
+        socket.stop
+      end
 
       # TODO only when we have our own Progress
       #boolean progress_orig = Progress::set (false);
-      SuSEFirewall.WriteOnly
+      firewall.write_only
       #Progress::set (progress_orig);
 
       true
@@ -215,36 +173,15 @@
     # Write all tftp-server settings
     # @return true on success
     def Write
-      # write the config file
-      # image dir: if does not exist, create with root:root rwxr-xr-x
-      # firewall??
-      # enable and (re)start xinetd
-
       return false if !WriteOnly()
 
-      # enable and (re)start xinetd
-
       # in.tftpd will linger around for 15 minutes waiting for a new connection
       # so we must kill it otherwise it will be using the old parameters
-      SCR.Execute(path(".target.bash"), "/usr/bin/killall in.tftpd")
-
-      if @start
-        Service.Restart(SERVICE_NAME)
-      else
-        # xinetd may be needed for other services so we never turn it
-        # off. It will exit anyway if no services are configured.
-        # If it is running, restart it.
-        service = SystemdService.find(SERVICE_NAME)
-        if service.nil?
-          log.error("Could not find service #{SERVICE_NAME}")
-          Report.Error(_("Cannot reload service %{name}") % { :name => 
SERVICE_NAME })
-        end
-        service.try_restart
-      end
+      SystemdService.find!("tftp").stop
 
       # TODO only when we have our own Progress
       #boolean progress_orig = Progress::set (false);
-      SuSEFirewall.ActivateConfiguration
+      firewall.reload
       #Progress::set (progress_orig);
 
       true
@@ -256,8 +193,7 @@
     def Set(settings)
       settings = deep_copy(settings)
       @start = Ops.get_boolean(settings, "start_tftpd", false)
-      @directory = Ops.get_string(settings, "tftp_directory", "")
-      @other_args = ""
+      @directory = Ops.get_string(settings, "tftp_directory", "/srv/tftpboot")
 
       nil
     end
@@ -328,9 +264,7 @@
     publish :variable => :required_packages, :type => "list <string>"
     publish :variable => :start, :type => "boolean"
     publish :variable => :directory, :type => "string"
-    publish :variable => :other_args, :type => "string"
     publish :variable => :foreign_servers, :type => "string"
-    publish :function => :ParseServerArgs, :type => "void (string)"
     publish :function => :Read, :type => "boolean ()"
     publish :function => :ForeignServersError, :type => "string ()"
     publish :function => :WriteOnly, :type => "boolean ()"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/src/scrconf/etc_xinetd_d_tftp.scr 
new/yast2-tftp-server-4.0.0/src/scrconf/etc_xinetd_d_tftp.scr
--- old/yast2-tftp-server-3.1.3/src/scrconf/etc_xinetd_d_tftp.scr       
2016-06-09 13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/src/scrconf/etc_xinetd_d_tftp.scr       
1970-01-01 01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-.etc.xinetd_d.tftp
-`ag_ini (
-    `IniAgent (
-       "/etc/xinetd.d/tftp",
-       $[
-           "options": ["no_nested_sections"],
-           // copied from SysConfigFile
-           "comments": [ "^[ \t]*#.*$", "#.*", "^[ \t]*$", ],
-           "sections": [
-               $[
-                   // header
-                   "begin": ["^[ \t]*service[ \t]+(tftp)[ \t]*$",
-                             "service %s"],
-                   // closing brace
-                   "end":   ["^[ \t]*\\}[ \t]*$",
-                             "}"],
-               ],
-           ],
-           "params": [
-               // normal parameters
-               // this is the default value type
-               $[
-                   "match": ["^[ \t]*([^ \t]*)[ \t]*=[ \t]*(.*[^ \t]|)[ \t]*$",
-                             "\t%-15s = %s"],
-               ],
-               // opening brace
-               $[
-                   "match": ["^[ \t]*(\\{)([ \t]*)$",
-                             "{"],
-               ],
-           ],
-       ]
-    )
-)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/test/cfa/tftp_sysconfig_test.rb 
new/yast2-tftp-server-4.0.0/test/cfa/tftp_sysconfig_test.rb
--- old/yast2-tftp-server-3.1.3/test/cfa/tftp_sysconfig_test.rb 1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-tftp-server-4.0.0/test/cfa/tftp_sysconfig_test.rb 2018-02-02 
18:19:19.000000000 +0100
@@ -0,0 +1,36 @@
+require_relative "../test_helper"
+
+require "cfa/memory_file"
+require "cfa/tftp_sysconfig"
+
+describe CFA::TftpSysconfig do
+  let(:file_handler) do
+    file_path = File.expand_path("../../data/tftp_sysconfig", __FILE__)
+    CFA::MemoryFile.new(File.read(file_path))
+  end
+
+  subject do
+    described_class.new(file_handler: file_handler)
+  end
+
+  before do
+    subject.load
+  end
+
+  describe "#load" do
+    it "loads all attributes" do
+      expect(subject.user).to eq "tftp"
+      expect(subject.directory).to eq "/srv/tftpboot"
+      expect(subject.options).to eq ""
+    end
+  end
+
+  describe "#save" do
+    it "stores properly attributes" do
+      subject.user = "root"
+      subject.save
+
+      expect(file_handler.content.lines).to include("TFTP_USER=\"root\"\n")
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/test/data/tftp_sysconfig 
new/yast2-tftp-server-4.0.0/test/data/tftp_sysconfig
--- old/yast2-tftp-server-3.1.3/test/data/tftp_sysconfig        1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-tftp-server-4.0.0/test/data/tftp_sysconfig        2018-02-02 
18:19:19.000000000 +0100
@@ -0,0 +1,26 @@
+## Description: TFTP Configuration
+## Type:    string
+## Default: "tftp"
+#
+#  daemon user (tftp)
+#
+TFTP_USER="tftp"
+
+## Type:    string
+## Default: ""
+##
+## INFO:
+#
+# tftp options
+#
+TFTP_OPTIONS=""
+
+## Type:    string
+## Default: "/srv/tftpboot"
+## was "/tftpboot" but
+## "/tftpboot" is not allowed anymore in FHS 2.2.
+#
+#  TFTP directory must be a world readable/writable directory.
+#  By default /srv/tftpboot is assumed.
+#
+TFTP_DIRECTORY="/srv/tftpboot"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/test/test_helper.rb 
new/yast2-tftp-server-4.0.0/test/test_helper.rb
--- old/yast2-tftp-server-3.1.3/test/test_helper.rb     1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-tftp-server-4.0.0/test/test_helper.rb     2018-02-02 
18:19:19.000000000 +0100
@@ -0,0 +1,27 @@
+ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)
+
+require "yast"
+require "yast/rspec"
+
+# stable testing in localized env
+ENV["LC_ALL"] = "en_US.UTF-8"
+
+if ENV["COVERAGE"]
+  require "simplecov"
+  SimpleCov.start do
+    add_filter "/test/"
+  end
+
+  src_location = File.expand_path("../../src", __FILE__)
+  # track all ruby files under src
+  SimpleCov.track_files("#{src_location}/**/*.rb")
+
+  # 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-tftp-server-3.1.3/testsuite/Makefile.am 
new/yast2-tftp-server-4.0.0/testsuite/Makefile.am
--- old/yast2-tftp-server-3.1.3/testsuite/Makefile.am   2016-06-09 
13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/testsuite/Makefile.am   1970-01-01 
01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-#
-# Makefile.am for .../testsuite
-#
-# Do not edit this file (Makefile.am) as it will be overwritten!
-#
-
-AUTOMAKE_OPTIONS = dejagnu
-EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard 
tests/*.rb)
-
-testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite
-
-all-local: $(testsuite_prepare)
-       make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir)
-
-clean-local: $(testsuite_prepare)
-       make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean
-
-check-local: $(testsuite_prepare)
-       make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check
-
-# EOF
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-tftp-server-3.1.3/testsuite/tests/readwrite.out 
new/yast2-tftp-server-4.0.0/testsuite/tests/readwrite.out
--- old/yast2-tftp-server-3.1.3/testsuite/tests/readwrite.out   2016-06-09 
13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/testsuite/tests/readwrite.out   1970-01-01 
01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-Execute        .target.bash_output "/usr/bin/lsof -i :tftp -Fc" $["exit":0, 
"stderr":"", "stdout":"p3316\ncxinetd\n"]
-Dir    .etc.xinetd_d.tftp.section: ["tftp"]
-Read   .etc.xinetd_d.tftp.value.tftp.disable nil
-Read   .etc.xinetd_d.tftp.value.tftp.server_args "-s -v /srv/boot"
-Return true
-Write  .etc.xinetd_d.tftp.value.tftp."{" "" true
-Write  .etc.xinetd_d.tftp.value_type.tftp."{" 1 true
-Write  .etc.xinetd_d.tftp.value.tftp.disable "yes" true
-Write  .etc.xinetd_d.tftp nil true
-Execute        .target.mkdir "/srv/boot" 0
-Execute        .target.bash "/usr/bin/killall in.tftpd" 0
-Return true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-tftp-server-3.1.3/testsuite/tests/readwrite.rb 
new/yast2-tftp-server-4.0.0/testsuite/tests/readwrite.rb
--- old/yast2-tftp-server-3.1.3/testsuite/tests/readwrite.rb    2016-06-09 
13:20:08.815784095 +0200
+++ new/yast2-tftp-server-4.0.0/testsuite/tests/readwrite.rb    1970-01-01 
01:00:00.000000000 +0100
@@ -1,61 +0,0 @@
-# encoding: utf-8
-
-# Module:  TFTP server configuration
-# Summary: Testsuite
-# Authors: Martin Vidner <mvid...@suse.cz>
-#
-# $Id$
-module Yast
-  class ReadwriteClient < Client
-    def main
-      # testedfiles: TftpServer.ycp Service.ycp Testsuite.ycp
-
-      Yast.include self, "testsuite.rb"
-
-      @READ = {
-        "etc"    => {
-          "xinetd_d" => {
-            "tftp" => {
-              "section" => { "tftp" => {} },
-              "value"   => {
-                "tftp" => {
-                  "disable"     => nil,
-                  "server_args" => "-s -v /srv/boot"
-                }
-              }
-            }
-          }
-        },
-        "target" => { "size" => 0 }
-      }
-
-      @WRITE = {}
-
-      @EXECUTE = {
-        "target" =>
-          #        "remove": true, // /etc/yp.conf.sv
-          {
-            # ok if used both for `lsof` and `rcfoo start`
-            "bash_output" => {
-              "exit"   => 0,
-              "stderr" => "",
-              "stdout" => "p3316\ncxinetd\n"
-            }
-          }
-      }
-
-      TESTSUITE_INIT([@READ, @WRITE, @EXECUTE], nil)
-
-      Yast.import "TftpServer"
-
-      TEST(lambda { TftpServer.Read }, [@READ, @WRITE, @EXECUTE], nil)
-      TEST(lambda { TftpServer.Write }, [@READ, @WRITE, @EXECUTE], nil) 
-
-      #READ["etc","xinetd_d","tftp","value","tftp","server_args"] = ...
-
-      nil
-    end
-  end
-end
-
-Yast::ReadwriteClient.new.main


Reply via email to