From 5ee7639c692d7c57b7ab1fa17fc97b4c9babe5fa Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 23 Jan 2020 10:02:44 +0100 Subject: [PATCH 1/5] fix return code of CLI show command (bsc#1143193) --- src/lib/y2ftp/clients/ftp_server.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/y2ftp/clients/ftp_server.rb b/src/lib/y2ftp/clients/ftp_server.rb index 3238aaf..cd8dec8 100644 --- a/src/lib/y2ftp/clients/ftp_server.rb +++ b/src/lib/y2ftp/clients/ftp_server.rb @@ -58,7 +58,8 @@ def run "handler" => fun_ref(method(:FTPdCMDShow), "boolean (map)"), # TRANSLATORS: CommandLine help "help" => _("Display settings"), - "example" => ["show"] + "example" => ["show"], + "readonly" => true }, "startup" => { "handler" => fun_ref(method(:FTPdCMDStartup), "boolean (map)"), @@ -543,7 +544,7 @@ def FTPdCMDShow(_options) end CommandLine.Print("") - false + true end def FTPdCMDStartup(options) From e5b78187358a9e7605ccb26fd0afc07f480fd664 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 23 Jan 2020 10:19:27 +0100 Subject: [PATCH 2/5] changes --- package/yast2-ftp-server.changes | 6 ++++++ package/yast2-ftp-server.spec | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package/yast2-ftp-server.changes b/package/yast2-ftp-server.changes index 9eef296..7bf217d 100644 --- a/package/yast2-ftp-server.changes +++ b/package/yast2-ftp-server.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 23 09:02:55 UTC 2020 - Josef Reidinger + +- fix return code of CLI show command (bsc#1143193) +- 4.2.4 + ------------------------------------------------------------------- Mon Dec 30 16:11:40 UTC 2019 - Josef Reidinger diff --git a/package/yast2-ftp-server.spec b/package/yast2-ftp-server.spec index 566560f..4c592ab 100644 --- a/package/yast2-ftp-server.spec +++ b/package/yast2-ftp-server.spec @@ -17,7 +17,7 @@ Name: yast2-ftp-server -Version: 4.2.3 +Version: 4.2.4 Release: 0 Summary: YaST2 - FTP configuration License: GPL-2.0-only @@ -27,14 +27,14 @@ Url: https://github.com/yast/yast-ftp-server Source0: %{name}-%{version}.tar.bz2 BuildRequires: update-desktop-files -# Yast2::Systemd::Service -BuildRequires: yast2 >= 4.1.3 +# Yast2::CommandLine readonly parameter +BuildRequires: yast2 >= 4.2.57 BuildRequires: yast2-devtools >= 4.2.2 BuildRequires: rubygem(%rb_default_ruby_abi:rspec) BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake) -# Yast2::Systemd::Service -Requires: yast2 >= 4.1.3 +# Yast2::CommandLine readonly parameter +Requires: yast2 >= 4.2.57 Requires: yast2-ruby-bindings >= 1.0.0 BuildArch: noarch From 51f1146f475716a8d62776068f4ae83448c63edf Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 23 Jan 2020 10:24:05 +0100 Subject: [PATCH 3/5] make rubocop happy --- src/lib/y2ftp/clients/ftp_server.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/y2ftp/clients/ftp_server.rb b/src/lib/y2ftp/clients/ftp_server.rb index cd8dec8..0c155b3 100644 --- a/src/lib/y2ftp/clients/ftp_server.rb +++ b/src/lib/y2ftp/clients/ftp_server.rb @@ -55,10 +55,10 @@ def run "finish" => fun_ref(Yast::FtpServer.method(:Write), "boolean ()"), "actions" => { "show" => { - "handler" => fun_ref(method(:FTPdCMDShow), "boolean (map)"), + "handler" => fun_ref(method(:FTPdCMDShow), "boolean (map)"), # TRANSLATORS: CommandLine help - "help" => _("Display settings"), - "example" => ["show"], + "help" => _("Display settings"), + "example" => ["show"], "readonly" => true }, "startup" => { From f82de4b24ad3ec0eaa924d6af7fba3ebc12f4e92 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 23 Jan 2020 10:48:35 +0100 Subject: [PATCH 4/5] Update package/yast2-ftp-server.changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Ladislav Slezák --- package/yast2-ftp-server.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/yast2-ftp-server.changes b/package/yast2-ftp-server.changes index 7bf217d..3986fc8 100644 --- a/package/yast2-ftp-server.changes +++ b/package/yast2-ftp-server.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Thu Jan 23 09:02:55 UTC 2020 - Josef Reidinger -- fix return code of CLI show command (bsc#1143193) +- Fix return code of CLI "show" command (bsc#1143193) - 4.2.4 ------------------------------------------------------------------- From 2956ac08e39f56d49fb508a593426ce0235e5907 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 23 Jan 2020 10:53:47 +0100 Subject: [PATCH 5/5] add test for cli show --- test/spec_helper.rb | 4 ++++ test/y2ftp/clients/ftp_server_test.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/test/spec_helper.rb b/test/spec_helper.rb index 5e61e9e..6803485 100644 --- a/test/spec_helper.rb +++ b/test/spec_helper.rb @@ -20,6 +20,10 @@ SRC_PATH = File.expand_path("../src", __dir__) ENV["Y2DIR"] = SRC_PATH +# localization agnostic tests +ENV["LC_ALL"] = "en_US.utf-8" +ENV["LANG"] = "en_US.utf-8" + require "yast" # stub module to prevent its Import diff --git a/test/y2ftp/clients/ftp_server_test.rb b/test/y2ftp/clients/ftp_server_test.rb index 8d86e95..8eaa64b 100644 --- a/test/y2ftp/clients/ftp_server_test.rb +++ b/test/y2ftp/clients/ftp_server_test.rb @@ -26,6 +26,8 @@ subject { described_class.new } describe "#FTPdCMDShow" do + let(:anon_authen) { "0" } + before do allow(Yast::FtpServer).to receive(:EDIT_SETTINGS).and_return("AnonAuthen" => anon_authen) @@ -71,5 +73,9 @@ subject.FTPdCMDShow({}) end end + + it "returns true" do + expect(subject.FTPdCMDShow({})).to eq true + end end end