Hello community, here is the log from the commit of package yast2-kdump for openSUSE:Factory checked in at 2015-07-27 09:08:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-kdump (Old) and /work/SRC/openSUSE:Factory/.yast2-kdump.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-kdump" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-kdump/yast2-kdump.changes 2015-07-05 17:52:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-kdump.new/yast2-kdump.changes 2015-07-27 09:08:40.000000000 +0200 @@ -1,0 +2,6 @@ +Tue Jul 21 15:34:11 UTC 2015 - igonzalezsosa@suse.com + +- Fix initialization of target value in the UI (bsc#935756). +- 3.1.25 + +------------------------------------------------------------------- Old: ---- yast2-kdump-3.1.24.tar.bz2 New: ---- yast2-kdump-3.1.25.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-kdump.spec ++++++ --- /var/tmp/diff_new_pack.cSc4Im/_old 2015-07-27 09:08:41.000000000 +0200 +++ /var/tmp/diff_new_pack.cSc4Im/_new 2015-07-27 09:08:41.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-kdump -Version: 3.1.24 +Version: 3.1.25 Release: 0 Summary: Configuration of kdump License: GPL-2.0 ++++++ yast2-kdump-3.1.24.tar.bz2 -> yast2-kdump-3.1.25.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-3.1.24/package/yast2-kdump.changes new/yast2-kdump-3.1.25/package/yast2-kdump.changes --- old/yast2-kdump-3.1.24/package/yast2-kdump.changes 2015-07-01 16:04:39.000000000 +0200 +++ new/yast2-kdump-3.1.25/package/yast2-kdump.changes 2015-07-22 10:49:37.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Jul 21 15:34:11 UTC 2015 - igonzalezsosa@suse.com + +- Fix initialization of target value in the UI (bsc#935756). +- 3.1.25 + +------------------------------------------------------------------- Wed Jul 1 15:26:31 CEST 2015 - dvaleev@suse.com - Require kdump on aarch64 but recommend on ppc32 this time. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-3.1.24/package/yast2-kdump.spec new/yast2-kdump-3.1.25/package/yast2-kdump.spec --- old/yast2-kdump-3.1.24/package/yast2-kdump.spec 2015-07-01 16:04:39.000000000 +0200 +++ new/yast2-kdump-3.1.25/package/yast2-kdump.spec 2015-07-22 10:49:37.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-kdump -Version: 3.1.24 +Version: 3.1.25 Release: 0 Summary: Configuration of kdump License: GPL-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-3.1.24/src/include/kdump/uifunctions.rb new/yast2-kdump-3.1.25/src/include/kdump/uifunctions.rb --- old/yast2-kdump-3.1.24/src/include/kdump/uifunctions.rb 2015-07-01 16:04:39.000000000 +0200 +++ new/yast2-kdump-3.1.25/src/include/kdump/uifunctions.rb 2015-07-22 10:49:37.000000000 +0200 @@ -263,12 +263,16 @@ if target != "" pos = Builtins.search(parse_target, "/") pos1 = -1 - Ops.set( - @KDUMP_SAVE_TARGET, - "target", - Builtins.substring(parse_target, 0, Ops.subtract(pos, 1)) - ) - parse_target = Builtins.substring(parse_target, Ops.add(pos, 2)) + if pos.zero? # Support for the old '/var/crash' style + Ops.set(@KDUMP_SAVE_TARGET, "target", "file") + else + Ops.set( + @KDUMP_SAVE_TARGET, + "target", + Builtins.substring(parse_target, 0, Ops.subtract(pos, 1)) + ) + parse_target = Builtins.substring(parse_target, Ops.add(pos, 2)) + end # file if Ops.get(@KDUMP_SAVE_TARGET, "target") == "file" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-3.1.24/test/include/uifunctions.rb new/yast2-kdump-3.1.25/test/include/uifunctions.rb --- old/yast2-kdump-3.1.24/test/include/uifunctions.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-kdump-3.1.25/test/include/uifunctions.rb 2015-07-22 10:49:37.000000000 +0200 @@ -0,0 +1,130 @@ +#!/usr/bin/env rspec + +require_relative "../test_helper" + +describe "Yast::KdumpUifunctionsInclude" do + + # Dummy client to test KdumpUifunctionsInclude + module DummyYast + class KdumpClient < Yast::Client + def main + Yast.include self, "kdump/uifunctions.rb" + end + + def initialize + main + end + + # Convenience method to expose @KDUMP_SAVE_TARGET + def target + @KDUMP_SAVE_TARGET + end + end + end + + DEFAULT_KDUMP_SAVE_TARGET = { + "target" => "file", + "server" => "", + "dir" => "", + "user_name" => "", + "port" => "", + "share" => "", + "password" => "" + } + + # Builds a target specification merging default values with new ones + # + # This is just a helper method for convenience. + # + # @param [Hash] attrs Attributes to override. + # @return [Hash] Target specification with overriden attributes. + def build_target(attrs = {}) + DEFAULT_KDUMP_SAVE_TARGET.merge(attrs) + end + + subject(:client) { DummyYast::KdumpClient.new } + + describe "#SetUpKDUMP_SAVE_TARGET" do + context "when target has no type" do + let(:target) { "/var/crash" } + + it "sets KDUMP_SAVE_TARGET as 'file' with path '/var/crash'" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target("dir" => "/var/crash", "target" => "file")) + end + end + + context "when target is like 'file:///var/crash'" do + let(:target) { "file:///var/crash" } + + it "sets KDUMP_SAVE_TARGET as 'file' with path '/var/crash'" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target("dir" => "/var/crash", "target" => "file")) + end + end + + context "when target is like 'ftp://user:pass@ftp.suse.com/pub'" do + let(:target) { "ftp://user:pass@ftp.suse.com/pub" } + + it "sets KDUMP_SAVE_TARGET as 'ftp' with server, user_name, password and dir" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target( + "target" => "ftp", "user_name" => "user", "password" => "pass", + "server" => "ftp.suse.com", "dir" => "/pub")) + end + end + + context "when target is like 'nfs://ftp.suse.cz/exports'" do + let(:target) { "nfs://nfs.suse.cz/exports" } + + it "sets KDUMP_SAVE_TARGET as 'nfs' with server and dir" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target( + "target" => "nfs", "server" => "nfs.suse.cz", "dir" => "/exports")) + end + end + + context "when target is like 'ssh://user:pass@people.suse.cz:9000/home/user/kdump'" do + let(:target) { "ssh://user:pass@people.suse.cz:9000/home/user/kdump" } + + it "sets KDUMP_SAVE_TARGET as 'ssh' with server, port, user_name, password and dir" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target( + "target" => "ssh", "user_name" => "user", "password" => "pass", + "server" => "people.suse.cz", "dir" => "/home/user/kdump", "port" => "9000")) + end + end + + context "when target is like 'sftp://user:pass@people.suse.cz:9000/home/user/kdump'" do + let(:target) { "sftp://user:pass@people.suse.cz:9000/home/user/kdump" } + + it "sets KDUMP_SAVE_TARGET 'sftp' with server, port, user_name, password and dir" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target( + "target" => "sftp", "user_name" => "user", "password" => "pass", + "server" => "people.suse.cz", "dir" => "/home/user/kdump", "port" => "9000")) + end + end + + context "when target is like 'cifs://user:pass@people.suse.cz/homes/user/kdump'" do + let(:target) { "cifs://user:pass@people.suse.cz/homes/user/kdump" } + + it "sets KDUMP_SAVE_TARGET 'cifs' with server, user_name, password, share and dir" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true) + expect(client.target).to eq(build_target( + "target" => "cifs", "user_name" => "user", "password" => "pass", + "server" => "people.suse.cz", "dir" => "/user/kdump", "share" => "homes" + )) + end + end + + context "when target is empty" do + let(:target) { "" } + + it "returns false" do + expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(false) + end + end + + end +end