Hello community,
here is the log from the commit of package yast2-iscsi-lio-server for
openSUSE:Factory checked in at 2019-03-05 12:23:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-iscsi-lio-server (Old)
and /work/SRC/openSUSE:Factory/.yast2-iscsi-lio-server.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-iscsi-lio-server"
Tue Mar 5 12:23:43 2019 rev:35 rq:681426 version:4.1.6
Changes:
--------
---
/work/SRC/openSUSE:Factory/yast2-iscsi-lio-server/yast2-iscsi-lio-server.changes
2019-03-01 16:50:14.589735296 +0100
+++
/work/SRC/openSUSE:Factory/.yast2-iscsi-lio-server.new.28833/yast2-iscsi-lio-server.changes
2019-03-05 12:23:44.648870298 +0100
@@ -1,0 +2,7 @@
+Mon Mar 04 10:34:15 CET 2019 - [email protected]
+
+- added error handling for loading discovery authentication data
+ (bsc#1118502)
+- 4.1.6
+
+-------------------------------------------------------------------
Old:
----
yast2-iscsi-lio-server-4.1.5.tar.bz2
New:
----
yast2-iscsi-lio-server-4.1.6.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-iscsi-lio-server.spec ++++++
--- /var/tmp/diff_new_pack.diheh9/_old 2019-03-05 12:23:45.328870091 +0100
+++ /var/tmp/diff_new_pack.diheh9/_new 2019-03-05 12:23:45.332870090 +0100
@@ -17,7 +17,7 @@
Name: yast2-iscsi-lio-server
-Version: 4.1.5
+Version: 4.1.6
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-iscsi-lio-server-4.1.5.tar.bz2 ->
yast2-iscsi-lio-server-4.1.6.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/package/yast2-iscsi-lio-server.changes
new/yast2-iscsi-lio-server-4.1.6/package/yast2-iscsi-lio-server.changes
--- old/yast2-iscsi-lio-server-4.1.5/package/yast2-iscsi-lio-server.changes
2019-03-01 13:27:27.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/package/yast2-iscsi-lio-server.changes
2019-03-04 14:58:36.000000000 +0100
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Mar 04 10:34:15 CET 2019 - [email protected]
+
+- added error handling for loading discovery authentication data
+ (bsc#1118502)
+- 4.1.6
+
+-------------------------------------------------------------------
Thu Feb 28 14:54:10 UTC 2019 - [email protected]
- update iscsi server setup documentation (bsc #1119698)
@@ -88,7 +95,7 @@
- bsc#1086029
Handle the case that users want to delete a LUNs which
- are not created yet(LUNs have data structure in memory but
+ are not created yet (LUNs have data structure in memory but
not execute command to create them).
-------------------------------------------------------------------
@@ -120,7 +127,7 @@
- Add message when failed to install python3-targetcli-fb
- Remove message which shown when user set userid = mutual_userid
Not leak this message since kernel keep slience.
--4.0.2
+- 4.0.2
-------------------------------------------------------------------
Fri Jan 26 11:52:12 UTC 2018 - [email protected]
@@ -148,7 +155,7 @@
- fate#318832, redesign authentication UI
- changed online help
- a bug fix for discovery session without authentication.
--3.2.0
+- 3.2.0
-------------------------------------------------------------------
Wed Jul 6 11:00:53 CEST 2016 - [email protected]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/package/yast2-iscsi-lio-server.spec
new/yast2-iscsi-lio-server-4.1.6/package/yast2-iscsi-lio-server.spec
--- old/yast2-iscsi-lio-server-4.1.5/package/yast2-iscsi-lio-server.spec
2019-03-01 13:27:27.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/package/yast2-iscsi-lio-server.spec
2019-03-04 14:58:36.000000000 +0100
@@ -17,7 +17,7 @@
Name: yast2-iscsi-lio-server
-Version: 4.1.5
+Version: 4.1.6
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/src/clients/iscsi-lio-server.rb
new/yast2-iscsi-lio-server-4.1.6/src/clients/iscsi-lio-server.rb
--- old/yast2-iscsi-lio-server-4.1.5/src/clients/iscsi-lio-server.rb
2019-03-01 13:27:27.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/src/clients/iscsi-lio-server.rb
2019-03-04 14:58:36.000000000 +0100
@@ -73,7 +73,7 @@
password = $discovery_auth.fetch_password
mutual_userid = $discovery_auth.fetch_mutual_userid
mutual_password = $discovery_auth.fetch_mutual_password
- cmd = 'targetcli'
+ cmd = '/usr/bin/targetcli'
p1 = "iscsi/ set discovery_auth "
# status == false means "No discovery auth" is not checked, means we
need enable discovery auth
if !status
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/src/include/iscsi-lio-server/TargetData.rb
new/yast2-iscsi-lio-server-4.1.6/src/include/iscsi-lio-server/TargetData.rb
--- old/yast2-iscsi-lio-server-4.1.5/src/include/iscsi-lio-server/TargetData.rb
2019-03-01 13:27:27.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/src/include/iscsi-lio-server/TargetData.rb
2019-03-04 14:58:36.000000000 +0100
@@ -32,7 +32,7 @@
end
def analyze
- @output = Yast::Execute.locally("targetcli", "backstores/ ls", stdout:
:capture)
+ @output = Yast::Execute.locally("/usr/bin/targetcli", "backstores/ ls",
stdout: :capture)
@backstores_output = @output.split("\n")
@backstores_output.each do |line|
if @backstore_path = RE_BACKSTORE_PATH.match(line)
@@ -383,7 +383,7 @@
def analyze
# We need to re-new @target_list, because something may be deleted
@targets_list = TargetList.new
- @target_outout = Yast::Execute.locally!.stdout("targetcli",
"ls").split("\n")
+ @target_outout = Yast::Execute.locally!.stdout("/usr/bin/targetcli",
"ls").split("\n")
@target_outout.each do |line|
# handle iqn targets here.
if RE_IQN_TARGET.match(line)
@@ -507,11 +507,13 @@
def acl_auth_info(data)
acl =
"iscsi/#{@current_target.fetch_target_name}/tpg#{@current_tpg.fetch_tpg_number}/acls/#{@initiator_name}/"
- Yast::Execute.locally!.stdout("targetcli", acl, "get", "auth",
data).split("=", 2).last
+ Yast::Execute.locally!.stdout("/usr/bin/targetcli", acl, "get", "auth",
data).split("=", 2).last
end
end
class DiscoveryAuth
+ include Yast::Logger
+
def initialize
@discovery_auth = {}
end
@@ -521,12 +523,7 @@
end
def fetch_status
- ret = @discovery_auth.fetch("status")
- if ret == "False \n"
- false
- else
- true
- end
+ @discovery_auth.fetch("status")
end
def store_userid(userid)
@@ -561,31 +558,48 @@
@discovery_auth.fetch("mutual_password")
end
+ # Query discovery authentication data from the system and store the
+ # data in the object.
def analyze
- cmd = "targetcli iscsi/ get discovery_auth enable"
- cmd_out = `#{cmd}`
- status = cmd_out[7,cmd_out.length]
- store_status(status)
-
- cmd = "targetcli iscsi/ get discovery_auth userid"
- cmd_out = `#{cmd}`
- userid = cmd_out[7,cmd_out.length]
- store_userid(userid)
-
- cmd = "targetcli iscsi/ get discovery_auth password"
- cmd_out = `#{cmd}`
- password = cmd_out[9,cmd_out.length]
- store_password(password)
-
- cmd = "targetcli iscsi/ get discovery_auth mutual_userid"
- cmd_out = `#{cmd}`
- mutual_userid = cmd_out[14,cmd_out.length]
- store_mutual_userid(mutual_userid)
-
- cmd = "targetcli iscsi/ get discovery_auth mutual_password"
- cmd_out = `#{cmd}`
- mutual_password = cmd_out[16,cmd_out.length]
- store_mutual_password(mutual_password)
+ restricted_recorder = RestrictedRecorder.new(Yast::Y2Logger.instance)
+ output = Yast::Execute.locally!("/usr/bin/targetcli", "iscsi/ get
discovery_auth enable userid "\
+ "password mutual_userid mutual_password", stdout: :capture, recorder:
restricted_recorder,
+ env: { "LC_ALL" => "C", "LANGUAGE" => "C" })
+
+ lines = output.split("\n")
+
+ analyze_lines(lines, "enable=") { |value|
store_status(value.strip.casecmp("true") == 0) }
+ analyze_lines(lines, "userid=") { |value| store_userid(value) }
+ analyze_lines(lines, "password=") { |value| store_password(value) }
+ analyze_lines(lines, "mutual_userid=") { |value|
store_mutual_userid(value) }
+ analyze_lines(lines, "mutual_password=") { |value|
store_mutual_password(value) }
+ end
+
+private
+
+ # A recorder for Cheetah that does not record stdout. Useful if stdout
+ # contains passwords.
+ class RestrictedRecorder < Cheetah::DefaultRecorder
+ def initialize(logger)
+ super(logger)
+ end
+
+ def record_stdout(stdout)
+ end
+ end
+
+ # Analyze the discovery authentication lines by searching for a line
+ # starting with needle and execute block for the value found in that
+ # line. If the needle is not found raises an exception.
+ def analyze_lines(lines, needle, &block)
+ line = lines.find { |tmp| tmp.start_with?(needle) }
+ if line.nil?
+ log.error "needle '#{needle}' not found"
+ raise "Failed to locate discovery authentication information in
targetcli output."
+ end
+
+ value = line[needle.length, line.length - needle.length]
+ block.call(value)
end
end
@@ -595,7 +609,7 @@
end
def execute_init_commands
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
commands = [
"set global auto_add_mapped_luns=false",
"set global auto_add_default_portal=false"
@@ -611,7 +625,7 @@
end
def execute_exit_commands
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
commands = [
"saveconfig",
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/src/include/iscsi-lio-server/UI_dialogs.rb
new/yast2-iscsi-lio-server-4.1.6/src/include/iscsi-lio-server/UI_dialogs.rb
--- old/yast2-iscsi-lio-server-4.1.5/src/include/iscsi-lio-server/UI_dialogs.rb
2019-03-01 13:27:27.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/src/include/iscsi-lio-server/UI_dialogs.rb
2019-03-04 14:58:36.000000000 +0100
@@ -18,7 +18,7 @@
Yast.import 'UI'
class NoDiscoveryAuth_CheckBox < ::CWM::CheckBox
- def initialize(container,value)
+ def initialize(container, value)
textdomain "iscsi-lio-server"
@config = value
@container_class = container
@@ -156,7 +156,7 @@
end
def label
- _('Autnentication by Targets')
+ _('Authentication by Targets')
end
def init
@@ -700,8 +700,8 @@
def validate
if !@no_discovery_auth_checkbox.value
if (!@target_discovery_auth.get_status) ||
(!@initiator_discovery_auth.get_status)
- err_msg = _("When Discovery Authentication is enabled.")
- err_msg += _("Plese use Authentication by initiator and Authentication
by targets together.")
+ err_msg = _("When Discovery Authentication is enabled.") + "\n"
+ err_msg += _("Please use Authentication by initiator and
Authentication by targets together.")
Yast::Popup.Error(err_msg)
return false
end
@@ -906,7 +906,7 @@
ip_list = []
re_ipv4 = Regexp.new(/[\d+\.]+\//)
re_ipv6 = Regexp.new(/[\w+\:]+\//)
- ret = Yast::Execute.locally('ip', 'a', stdout: :capture)
+ ret = Yast::Execute.locally('/sbin/ip', 'a', stdout: :capture)
ip = ret.split("\n")
ip.each do |line|
line = line.strip
@@ -1065,7 +1065,7 @@
def add_item(item)
failed = false
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
p1 = "iscsi/" + @target_name + "/tpg" + @tpg_num.to_s + "/acls create " +
item[1]
if item[0] < 5000
enable_auto_add_mapped_luns
@@ -1095,7 +1095,7 @@
def delete_item(item)
failed = false
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
p1 = "iscsi/" + @target_name + "/tpg" + @tpg_num.to_s + "/acls delete " +
item[1]
begin
Cheetah.run(cmd, p1)
@@ -1128,7 +1128,7 @@
end
def enable_auto_add_mapped_luns
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
p1 = "set global auto_add_mapped_luns=true"
begin
Cheetah.run(cmd, p1)
@@ -1140,7 +1140,7 @@
end
def disable_auto_add_mapped_luns
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
p1 = "set global auto_add_mapped_luns=false"
begin
Cheetah.run(cmd, p1)
@@ -1332,7 +1332,7 @@
return false
end
failed_mapping_luns = []
- cmd = 'targetcli'
+ cmd = '/usr/bin/targetcli'
@mapping_luns_added.each do |elem|
p1 = 'iscsi/' + @target_name + "/tpg" + @tpg_num + "/acls/" +
@initiator_name + "/ create mapped_lun=" + \
elem[1].to_s + " tpg_lun_or_backstore=" + elem[2].to_s
@@ -1632,7 +1632,7 @@
target_name = @info[0]
tpg_num = @info[1]
initiator_name = @info[2]
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
if @auth_by_initiator.value
p1 = "iscsi/" + target_name + "/tpg" + tpg_num + "/acls/" +
initiator_name + \
"/ set auth mutual_userid=" + mutual_username + " mutual_password=" +
mutual_password
@@ -1742,7 +1742,7 @@
target_name = @info[0]
tpg_num = @info[1]
initiator_name = @info[2]
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
if @auth_by_target.value
p1 = "iscsi/" + target_name + "/tpg" + tpg_num + "/acls/" +
initiator_name + \
"/ set auth userid=" + username + " password=" + password
@@ -1927,7 +1927,7 @@
end
def validate
- cmd = "targetcli iscsi/" + @target_name + "/tpg" + @target_tpg + "/ get
attribute authentication"
+ cmd = "/usr/bin/targetcli iscsi/" + @target_name + "/tpg" + @target_tpg +
"/ get attribute authentication"
cmd_out = `#{cmd}`
ret = cmd_out[15, cmd_out.length]
if ret == "1 \n"
@@ -2055,7 +2055,7 @@
end
if @mode == 'edit'
- cmd = "targetcli iscsi/" + @target_name + "/tpg" + tpg_num + "/ get
attribute authentication"
+ cmd = "/usr/bin/targetcli iscsi/" + @target_name + "/tpg" + tpg_num + "/
get attribute authentication"
cmd_out = `#{cmd}`
ret = cmd_out[15, cmd_out.length]
if ret == "1 \n"
@@ -2115,7 +2115,7 @@
portal_addr = @IP_selsection_box.get_addr
port = @target_port_num_field.get_value.to_s
bind_all = @target_bind_all_ip_checkbox.get_value
- cmd = 'targetcli'
+ cmd = '/usr/bin/targetcli'
if @mode == 'new'
p1 = 'iscsi/ create'
if @target_name_input_field.get_value.bytesize > @iscsi_name_length_max
@@ -2359,7 +2359,7 @@
def create_ACLs_dialog(info)
if !info.empty?
- cmd = "targetcli iscsi/" + info[0] + "/tpg" + info[1] + "/ get attribute
authentication"
+ cmd = "/usr/bin/targetcli iscsi/" + info[0] + "/tpg" + info[1] + "/ get
attribute authentication"
cmd_out = `#{cmd}`
ret = cmd_out[15, cmd_out.length]
if ret == "1 \n"
@@ -2396,7 +2396,7 @@
info = @edit_target_page.get_target_info
create_ACLs_dialog(info)
when :delete
- cmd = 'targetcli'
+ cmd = '/usr/bin/targetcli'
target = @target_table.get_selected
if target == nil
return nil
@@ -2509,7 +2509,7 @@
def validate
failed_storage = ""
@luns_added.each do |lun|
- cmd = 'targetcli'
+ cmd = '/usr/bin/targetcli'
if !lun[2].empty?
case lun[4]
when "file"
@@ -2875,7 +2875,7 @@
@lun_table.table_remove_lun(lun[3])
return nil
end
- cmd = "targetcli"
+ cmd = "/usr/bin/targetcli"
p1 = "backstores/"
if lun[4] == "file"
p1 += "fileio delete " + lun[2]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/test/discovery_auth_test.rb
new/yast2-iscsi-lio-server-4.1.6/test/discovery_auth_test.rb
--- old/yast2-iscsi-lio-server-4.1.5/test/discovery_auth_test.rb
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/test/discovery_auth_test.rb
2019-03-04 14:58:36.000000000 +0100
@@ -0,0 +1,57 @@
+#!/usr/bin/env rspec
+# encoding: utf-8
+
+# Copyright (c) [2019] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "./test_helper"
+
+require "TargetData"
+
+describe DiscoveryAuth do
+ describe "#analyze" do
+ before do
+ allow(Yast::Execute).to receive(:locally!).and_return(output)
+ end
+
+ let(:execute_object) { Yast::Execute.new }
+
+ context "when 'targetcli' output is correct" do
+ let(:output) { fixture("auth-typical") }
+
+ it "reads the correct values" do
+ subject.analyze
+
+ expect(subject.fetch_status).to eq true
+ expect(subject.fetch_userid).to eq "name1"
+ expect(subject.fetch_password).to eq "secret1"
+ expect(subject.fetch_mutual_userid).to eq "name2"
+ expect(subject.fetch_mutual_password).to eq "secret2"
+ end
+ end
+
+ context "when 'targetcli' output is broken" do
+ let(:output) { fixture("auth-broken") }
+
+ it "raises an exception" do
+ expect { subject.analyze }.to raise_error(Exception)
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/test/fixtures/auth-broken
new/yast2-iscsi-lio-server-4.1.6/test/fixtures/auth-broken
--- old/yast2-iscsi-lio-server-4.1.5/test/fixtures/auth-broken 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/test/fixtures/auth-broken 2019-03-04
14:58:36.000000000 +0100
@@ -0,0 +1,3 @@
+enable=True
+userid=name1
+password=secret1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/test/fixtures/auth-typical
new/yast2-iscsi-lio-server-4.1.6/test/fixtures/auth-typical
--- old/yast2-iscsi-lio-server-4.1.5/test/fixtures/auth-typical 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/test/fixtures/auth-typical 2019-03-04
14:58:36.000000000 +0100
@@ -0,0 +1,5 @@
+enable=True
+userid=name1
+password=secret1
+mutual_userid=name2
+mutual_password=secret2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-lio-server-4.1.5/test/target_data_test.rb
new/yast2-iscsi-lio-server-4.1.6/test/target_data_test.rb
--- old/yast2-iscsi-lio-server-4.1.5/test/target_data_test.rb 2019-03-01
13:27:27.000000000 +0100
+++ new/yast2-iscsi-lio-server-4.1.6/test/target_data_test.rb 2019-03-04
14:58:36.000000000 +0100
@@ -29,7 +29,7 @@
before do
allow(Yast::Execute).to receive(:locally!).and_return(execute_object)
- allow(execute_object).to receive(:stdout).with("targetcli",
"ls").and_return(output)
+ allow(execute_object).to receive(:stdout).with("/usr/bin/targetcli",
"ls").and_return(output)
end
let(:execute_object) { Yast::Execute.new }
@@ -46,16 +46,16 @@
let(:output) { fixture("ls-typical") }
before do
- allow(execute_object).to receive(:stdout).with("targetcli", acl,
"get", "auth", "userid")
+ allow(execute_object).to receive(:stdout).with("/usr/bin/targetcli",
acl, "get", "auth", "userid")
.and_return("userid=teddybear")
- allow(execute_object).to receive(:stdout).with("targetcli", acl,
"get", "auth", "password")
+ allow(execute_object).to receive(:stdout).with("/usr/bin/targetcli",
acl, "get", "auth", "password")
.and_return("password=plush")
- allow(execute_object).to receive(:stdout).with("targetcli", acl,
"get", "auth", "mutual_userid")
+ allow(execute_object).to receive(:stdout).with("/usr/bin/targetcli",
acl, "get", "auth", "mutual_userid")
.and_return("mutual_userid=foo")
- allow(execute_object).to receive(:stdout).with("targetcli", acl,
"get", "auth", "mutual_password")
+ allow(execute_object).to receive(:stdout).with("/usr/bin/targetcli",
acl, "get", "auth", "mutual_password")
.and_return("mutual_password=bar")
end