Hello community, here is the log from the commit of package yast2-iscsi-client for openSUSE:Factory checked in at 2018-12-31 09:44:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-iscsi-client (Old) and /work/SRC/openSUSE:Factory/.yast2-iscsi-client.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-iscsi-client" Mon Dec 31 09:44:52 2018 rev:120 rq:660229 version:4.1.4 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-iscsi-client/yast2-iscsi-client.changes 2018-11-10 16:50:41.236393728 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-iscsi-client.new.28833/yast2-iscsi-client.changes 2018-12-31 09:44:54.478289391 +0100 @@ -1,0 +2,13 @@ +Thu Dec 13 16:42:21 UTC 2018 - [email protected] + +- always use absolute path to binaries (bsc#1118291) +- properly escape shell arguments (bsc#1118291) +- 4.1.4 + +------------------------------------------------------------------- +Sun Nov 25 00:21:37 UTC 2018 - Stasiek Michalski <[email protected]> + +- Provide icon with module (boo#1109310) +- 4.1.3 + +------------------------------------------------------------------- Old: ---- yast2-iscsi-client-4.1.2.tar.bz2 New: ---- yast2-iscsi-client-4.1.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-iscsi-client.spec ++++++ --- /var/tmp/diff_new_pack.hrH60p/_old 2018-12-31 09:44:54.878289064 +0100 +++ /var/tmp/diff_new_pack.hrH60p/_new 2018-12-31 09:44:54.882289060 +0100 @@ -17,7 +17,7 @@ Name: yast2-iscsi-client -Version: 4.1.2 +Version: 4.1.4 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -73,6 +73,7 @@ %{yast_scrconfdir}/iscsid.scr %doc %{yast_docdir} %{yast_schemadir}/autoyast/rnc/iscsi-client.rnc +%{yast_icondir} %license COPYING %changelog ++++++ yast2-iscsi-client-4.1.2.tar.bz2 -> yast2-iscsi-client-4.1.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/package/yast2-iscsi-client.changes new/yast2-iscsi-client-4.1.4/package/yast2-iscsi-client.changes --- old/yast2-iscsi-client-4.1.2/package/yast2-iscsi-client.changes 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/package/yast2-iscsi-client.changes 2018-12-20 10:30:23.000000000 +0100 @@ -1,4 +1,17 @@ ------------------------------------------------------------------- +Thu Dec 13 16:42:21 UTC 2018 - [email protected] + +- always use absolute path to binaries (bsc#1118291) +- properly escape shell arguments (bsc#1118291) +- 4.1.4 + +------------------------------------------------------------------- +Sun Nov 25 00:21:37 UTC 2018 - Stasiek Michalski <[email protected]> + +- Provide icon with module (boo#1109310) +- 4.1.3 + +------------------------------------------------------------------- Fri Nov 09 12:34:19 CET 2018 - [email protected] - removed onboot startup mode for LUNs on S/390 (bsc#1045139) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/package/yast2-iscsi-client.spec new/yast2-iscsi-client-4.1.4/package/yast2-iscsi-client.spec --- old/yast2-iscsi-client-4.1.2/package/yast2-iscsi-client.spec 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/package/yast2-iscsi-client.spec 2018-12-20 10:30:23.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-iscsi-client -Version: 4.1.2 +Version: 4.1.4 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -73,4 +73,5 @@ %{yast_scrconfdir}/iscsid.scr %doc %{yast_docdir} %{yast_schemadir}/autoyast/rnc/iscsi-client.rnc +%{yast_icondir} %license COPYING diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/Makefile.am new/yast2-iscsi-client-4.1.4/src/Makefile.am --- old/yast2-iscsi-client-4.1.2/src/Makefile.am 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/Makefile.am 2018-12-20 10:30:23.000000000 +0100 @@ -26,6 +26,13 @@ desktop_DATA = \ desktop/iscsi-client.desktop -EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(schemafiles_DATA) $(desktop_DATA) +symbolicdir = @icondir@/hicolor/symbolic/apps +symbolic_DATA = \ + icons/hicolor/symbolic/apps/yast-iscsi-client-symbolic.svg +scalabledir = @icondir@/hicolor/scalable/apps +scalable_DATA = \ + icons/hicolor/scalable/apps/yast-iscsi-client.svg -include $(top_srcdir)/Makefile.am.common \ No newline at end of file +EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(schemafiles_DATA) $(desktop_DATA) $(symbolic_DATA) $(scalable_DATA) + +include $(top_srcdir)/Makefile.am.common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/clients/inst_iscsi-client.rb new/yast2-iscsi-client-4.1.4/src/clients/inst_iscsi-client.rb --- old/yast2-iscsi-client-4.1.2/src/clients/inst_iscsi-client.rb 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/clients/inst_iscsi-client.rb 2018-12-20 10:30:23.000000000 +0100 @@ -65,10 +65,9 @@ SCR.Execute( path(".target.bash"), - "mkdir -p /etc/iscsi; touch /etc/iscsi/initiatorname.iscsi; ln -s /etc/iscsi/initiatorname.iscsi /etc/initiatorname.iscsi" + "/usr/bin/mkdir -p /etc/iscsi; /usr/bin/touch /etc/iscsi/initiatorname.iscsi; /usr/bin/ln -s /etc/iscsi/initiatorname.iscsi /etc/initiatorname.iscsi" ) # check initiator name, create if not exists - # WFM::Execute (.local.bash,"test -d /etc/iscsi/ && /bin/cp -a /etc/iscsi/* " + String::Quote(Installation::destdir) + "/etc/iscsi/"); IscsiClientLib.checkInitiatorName IscsiClientLib.getiBFT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/clients/iscsi-client_finish.rb new/yast2-iscsi-client-4.1.4/src/clients/iscsi-client_finish.rb --- old/yast2-iscsi-client-4.1.2/src/clients/iscsi-client_finish.rb 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/clients/iscsi-client_finish.rb 2018-12-20 10:30:23.000000000 +0100 @@ -32,6 +32,8 @@ # require "yast2/systemd/socket" +require "shellwords" + module Yast class IscsiClientFinishClient < Client def main @@ -74,19 +76,9 @@ # write open-iscsi database of automatic connected targets WFM.Execute( path(".local.bash"), - Ops.add( - Ops.add( - Ops.add( - Ops.add( - "test -d /etc/iscsi/ && mkdir -p '", - String.Quote(Installation.destdir) - ), - "/etc/iscsi' && cp -a /etc/iscsi/* '" - ), - String.Quote(Installation.destdir) - ), - "/etc/iscsi/'" - ) + "/usr/bin/test -d /etc/iscsi/ && " \ + "mkdir -p #{Installation.destdir.shellescape}/etc/iscsi && " \ + "cp -a /etc/iscsi/* #{Installation.destdir.shellescape}/etc/iscsi/" ) if Ops.greater_than(Builtins.size(IscsiClientLib.sessions), 0) Builtins.y2milestone("enabling iscsi and iscsid service/socket") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/icons/hicolor/scalable/apps/yast-iscsi-client.svg new/yast2-iscsi-client-4.1.4/src/icons/hicolor/scalable/apps/yast-iscsi-client.svg --- old/yast2-iscsi-client-4.1.2/src/icons/hicolor/scalable/apps/yast-iscsi-client.svg 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/icons/hicolor/scalable/apps/yast-iscsi-client.svg 2018-12-20 10:30:23.000000000 +0100 @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="128" height="128" version="1.1" viewBox="0 0 128 128.00001" xmlns="http://www.w3.org/2000/svg"> +<defs> +<linearGradient id="c" x1="10" x2="10" y1="3" y2="37" gradientTransform="matrix(2,0,0,2,-2e-7,14)" gradientUnits="userSpaceOnUse"> +<stop stop-color="#acaba8" offset="0"/> +<stop stop-color="#cac9c6" offset="1"/> +</linearGradient> +<linearGradient id="b" x1="3" x2="29" y1="17" y2="17" gradientTransform="matrix(4,0,0,4,0,-8)" gradientUnits="userSpaceOnUse"> +<stop stop-color="#9a9996" offset="0"/> +<stop stop-color="#deddda" offset=".037101"/> +<stop stop-color="#9a9996" offset=".076507"/> +<stop stop-color="#9a9996" offset=".92289"/> +<stop stop-color="#deddda" offset=".96229"/> +<stop stop-color="#9a9996" offset="1"/> +</linearGradient> +<linearGradient id="a" x1="13.17" x2="13" y1="21" y2="11" gradientTransform="matrix(4,0,0,4,0,-12)" gradientUnits="userSpaceOnUse"> +<stop stop-color="#f6f5f4" offset="0"/> +<stop stop-color="#deddda" offset="1"/> +</linearGradient> +</defs> +<rect x="12" y="32" width="104" height="68" ry="8"/> +<rect x="12" y="24" width="104" height="68" ry="8" fill="url(#b)"/> +<rect x="12" y="20" width="104" height="68" ry="8" fill="url(#c)"/> +<rect x="108" y="80" width="4" height="4" ry="2" fill="#77767b"/> +<rect x="108" y="24" width="4" height="4" ry="2" fill="#77767b"/> +<rect x="52" y="24" width="4" height="4" ry="2" fill="#77767b"/> +<rect x="20" y="24" width="4" height="4" ry="2" fill="#77767b"/> +<rect x="20" y="80" width="4" height="4" ry="2" fill="#77767b"/> +<rect x="52" y="80" width="4" height="4" ry="2" fill="#77767b"/> +<path d="m32 28a4.0004 4.0004 0 0 0 -4 4c0 2.2565-1.7435 4-4 4a4.0004 4.0004 0 0 0 -4 4v32a4.0004 4.0004 0 0 0 4 4c2.2565 0 4 1.7435 4 4a4.0004 4.0004 0 0 0 4 4h12a4.0004 4.0004 0 0 0 4 -4c0-2.2538 1.7396-3.9959 3.9922-4 0.0426 0.0014 0.08632 0.0052 0.125 8e-3a4.0004 4.0004 0 0 0 0.56248 -8e-3h6.5624c5.1432 4.8128 11.847 7.9952 18.898 8 7.3304 0 14.614-3.0198 19.797-8.2032s8.2032-12.466 8.2032-19.797-3.0198-14.614-8.2032-19.797c-5.1832-5.1832-12.466-8.2032-19.797-8.2032a4.0004 4.0004 0 0 0 -8e-3 0c-7.0416 0.0106-13.73 3.1955-18.867 8h-7.2656c-2.2565 0-4-1.7435-4-4a4.0004 4.0004 0 0 0 -4 -4z" fill="#acaba8"/> +<path d="m32 24a4.0004 4.0004 0 0 0 -4 4c0 2.2565-1.7435 4-4 4a4.0004 4.0004 0 0 0 -4 4v32a4.0004 4.0004 0 0 0 4 4c2.2565 0 4 1.7435 4 4a4.0004 4.0004 0 0 0 4 4h12a4.0004 4.0004 0 0 0 4 -4c0-2.2538 1.7396-3.9959 3.9922-4 0.0426 0.0014 0.08632 0.0052 0.125 8e-3a4.0004 4.0004 0 0 0 0.56248 -8e-3h6.5624c5.1432 4.8128 11.847 7.9952 18.898 8 7.3304 0 14.614-3.0198 19.797-8.2032s8.2032-12.466 8.2032-19.797-3.0198-14.614-8.2032-19.797c-5.1832-5.1832-12.466-8.2032-19.797-8.2032a4.0004 4.0004 0 0 0 -8e-3 0c-7.0416 0.0106-13.73 3.1955-18.867 8h-7.2656c-2.2565 0-4-1.7435-4-4a4.0004 4.0004 0 0 0 -4 -4z" fill="url(#a)"/> +<rect x="72" y="40" width="16" height="16" ry="8" fill="#adaba7" fill-opacity=".9959"/> +<rect x="72" y="44" width="16" height="16" ry="8" fill="#cac9c6" fill-opacity=".9959"/> +<rect x="48" y="108" width="32" height="12" ry="4" fill="#613583"/> +<rect x="16" y="112" width="96" height="4" ry="0" fill="#613583"/> +<rect x="60" y="96" width="8" height="12" fill="#a347ba"/> +<rect x="48" y="104" width="32" height="12" ry="4" fill="#a347ba"/> +<rect x="16" y="108" width="96" height="4" ry="0" fill="#a347ba"/> +</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/icons/hicolor/symbolic/apps/yast-iscsi-client-symbolic.svg new/yast2-iscsi-client-4.1.4/src/icons/hicolor/symbolic/apps/yast-iscsi-client-symbolic.svg --- old/yast2-iscsi-client-4.1.2/src/icons/hicolor/symbolic/apps/yast-iscsi-client-symbolic.svg 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/icons/hicolor/symbolic/apps/yast-iscsi-client-symbolic.svg 2018-12-20 10:30:23.000000000 +0100 @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"> + <path d="M 4 0 C 2.892 0 2 0.892 2 2 L 2 11 C 2 12.108 2.892 13 4 13 L 7 13 L 7 14 L 3 14 L 3 16 L 10 16 L 10 14 L 9 14 L 9 13 L 10 13 L 10 10 L 14 10 L 14 2 C 14 0.892 13.108 0 12 0 L 4 0 z M 8 2 C 10.216 2 12 3.784 12 6 C 12 8.216 10.216 10 8 10 L 4 10 L 4 6 C 4 3.784 5.784 2 8 2 z M 8 4 C 6.892 4 6 4.892 6 6 C 6 7.108 6.892 8 8 8 C 9.108 8 10 7.108 10 6 C 10 4.892 9.108 4 8 4 z M 11 11 L 11 16 L 16 16 L 16 11 L 11 11 z M 12 12 L 13 12 L 13 13 L 14 13 L 14 12 L 15 12 L 15 14 L 14 14 L 14 15 L 13 15 L 13 14 L 12 14 L 12 12 z " fill="#c0bfbc" /> +</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/include/iscsi-client/dialogs.rb new/yast2-iscsi-client-4.1.4/src/include/iscsi-client/dialogs.rb --- old/yast2-iscsi-client-4.1.2/src/include/iscsi-client/dialogs.rb 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/include/iscsi-client/dialogs.rb 2018-12-20 10:30:23.000000000 +0100 @@ -432,7 +432,6 @@ VStretch() ) - help = CWM.MergeHelps(w) contents = CWM.PrepareDialog(contents, w) Wizard.SetContentsButtons( caption, @@ -459,7 +458,6 @@ 1 )) ) - help = CWM.MergeHelps(w) contents = CWM.PrepareDialog(contents, w) Wizard.SetContentsButtons( caption, @@ -497,7 +495,6 @@ VStretch() ) - help = CWM.MergeHelps(w) contents = CWM.PrepareDialog(contents, w) Wizard.SetContentsButtons( caption, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/include/iscsi-client/widgets.rb new/yast2-iscsi-client-4.1.4/src/include/iscsi-client/widgets.rb --- old/yast2-iscsi-client-4.1.2/src/include/iscsi-client/widgets.rb 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/include/iscsi-client/widgets.rb 2018-12-20 10:30:23.000000000 +0100 @@ -27,6 +27,9 @@ # Authors: Michal Zugec <[email protected]> # # Main file for iscsi-client configuration. Uses all other files. + +require "shellwords" + module Yast module IscsiClientWidgetsInclude def initialize_iscsi_client_widgets(_include_target) @@ -526,6 +529,7 @@ when :auth_out status = Convert.to_boolean(UI.QueryWidget(Id(:auth_out), :Value)) end + # FIXME: status unused, so this method do nothing end nil end @@ -565,7 +569,7 @@ if !IP.Check(ip) # check for valid host name result = SCR.Execute(path(".target.bash_output"), - "LC_ALL=POSIX host #{ip}") + "LC_ALL=POSIX host #{ip.shellescape}") Builtins.y2milestone("Cmd: host %1, result: %2", ip, result) output = result["stdout"] || "" @@ -762,15 +766,13 @@ cmd = IscsiClientLib.GetAdmCmd( Builtins.sformat( "-m node -T %1 -p %2 -I %3 --op=delete", - Ops.get(params, 1, ""), - Ops.get(params, 0, ""), - Ops.get(params, 2, "") + Ops.get(params, 1, "").shellescape, + Ops.get(params, 0, "").shellescape, + Ops.get(params, 2, "").shellescape ) ) - Builtins.y2milestone( - "%1", - SCR.Execute(path(".target.bash_output"), cmd, {}) - ) + result = SCR.Execute(path(".target.bash_output"), cmd, {}) + Builtins.y2milestone(result.inspect) IscsiClientLib.readSessions initDiscoveredTable("") if selected != nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-iscsi-client-4.1.2/src/modules/IscsiClientLib.rb new/yast2-iscsi-client-4.1.4/src/modules/IscsiClientLib.rb --- old/yast2-iscsi-client-4.1.2/src/modules/IscsiClientLib.rb 2018-11-09 14:46:40.000000000 +0100 +++ new/yast2-iscsi-client-4.1.4/src/modules/IscsiClientLib.rb 2018-12-20 10:30:23.000000000 +0100 @@ -25,12 +25,16 @@ require "yast2/systemd/socket" require "ipaddr" +require "shellwords" + module Yast class IscsiClientLibClass < Module include Yast::Logger Yast.import "Arch" + OFFLOAD_SCRIPT = "/sbin/iscsi_offload".freeze + def main textdomain "iscsi-client" @@ -67,8 +71,6 @@ # interface type for hardware offloading @offload_card = "default" - @offboard_script = "iscsi_offload" - @offload = [ ["default", _("default (Software)"), [], []], ["all", _("all"), [], []], @@ -175,7 +177,7 @@ # @return [String] complete command # def GetAdmCmd(params, do_log = true) - ret = "LC_ALL=POSIX iscsiadm" + ret = "LC_ALL=POSIX /sbin/iscsiadm" ret = Ops.add(Ops.add(ret, " "), params) Builtins.y2milestone("GetAdmCmd: #{ret}") if do_log ret @@ -237,7 +239,7 @@ return @ibft end ret = SCR.Execute(path(".target.bash_output"), - "lsmod |grep -q iscsi_ibft || modprobe iscsi_ibft") + "/usr/bin/lsmod | /usr/bin/grep -q iscsi_ibft || /usr/sbin/modprobe iscsi_ibft") log.info "check and modprobe iscsi_ibft: #{ret}" @ibft = nodeInfoToMap(getFirmwareInfo) @@ -322,16 +324,12 @@ cmdline = GetAdmCmd( Builtins.sformat( "-S -m node -I %3 -T %1 -p %2", - Ops.get(@currentRecord, 1, ""), - Ops.get(@currentRecord, 0, ""), - Ops.get(@currentRecord, 2, "default") + Ops.get(@currentRecord, 1, "").shellescape, + Ops.get(@currentRecord, 0, "").shellescape, + Ops.get(@currentRecord, 2, "default").shellescape ) ) - cmd = Convert.convert( - SCR.Execute(path(".target.bash_output"), cmdline), - :from => "any", - :to => "map <string, any>" - ) + cmd = SCR.Execute(path(".target.bash_output"), cmdline) return {} if Ops.get_integer(cmd, "exit", 0) != 0 auth = {} Builtins.foreach( @@ -509,11 +507,7 @@ # get all discovered targets def getDiscovered @discovered = [] - retcode = Convert.convert( - SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m node -P 1")), - :from => "any", - :to => "map <string, any>" - ) + retcode = SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m node -P 1")) if Builtins.size(Ops.get_string(retcode, "stderr", "")) == 0 @discovered = ScanDiscovered( Builtins.splitstring(Ops.get_string(retcode, "stdout", ""), "\n") @@ -529,20 +523,16 @@ end def restart_iscsid_initial - retcode = Convert.to_integer(SCR.Execute(path(".target.bash"), "pgrep iscsid")) + retcode = SCR.Execute(path(".target.bash"), "/usr/bin/pgrep iscsid") Service.Stop("iscsid") if retcode == 0 start_iscsid_initial end def start_iscsid_initial - SCR.Execute(path(".target.bash"), "pgrep iscsid || /sbin/iscsid") - Builtins.foreach([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) do |i| + SCR.Execute(path(".target.bash"), "/usr/bin/pgrep iscsid || /sbin/iscsid") + 10.times do |i| Builtins.sleep(1 * 1000) - cmd = Convert.convert( - SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m session")), - :from => "any", - :to => "map <string, any>" - ) + cmd = SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m session")) Builtins.y2internal( "iteration %1, retcode %2", i, @@ -550,7 +540,7 @@ ) if Ops.get_integer(cmd, "exit", -1) == 0 Builtins.y2internal("Good response from daemon, exit.") - raise Break + break end end @@ -560,11 +550,7 @@ # get all connected targets def readSessions Builtins.y2milestone("reading current settings") - retcode = Convert.convert( - SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m session -P 1")), - :from => "any", - :to => "map <string, any>" - ) + retcode = SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m session -P 1")) @sessions = ScanDiscovered( Builtins.splitstring(Ops.get_string(retcode, "stdout", ""), "\n") ) @@ -602,7 +588,7 @@ Builtins.y2milestone("%1 file exists, create backup", file) SCR.Execute( path(".target.bash"), - Builtins.sformat("mv %1 /etc/iscsi/initiatorname.yastbackup", file) + Builtins.sformat("/usr/bin/mv %1 /etc/iscsi/initiatorname.yastbackup", file.shellescape) ) end ret = SCR.Write( @@ -627,11 +613,7 @@ def getReverseDomainName host_fq = Hostname.SplitFQ( Ops.get_string( - Convert.convert( - SCR.Execute(path(".target.bash_output"), "hostname -f|tr -d '\n'"), - :from => "any", - :to => "map <string, any>" - ), + SCR.Execute(path(".target.bash_output"), "/usr/bin/hostname -f | /usr/bin/tr -d '\n'"), "stdout", "" ) @@ -659,16 +641,12 @@ name_from_bios = getiBFT["iface.initiatorname"] || "" # if (size((map<string, any>)SCR::Read (.target.lstat, file)) == 0 || ((map<string, any>)SCR::Read (.target.lstat, file))["size"]:0==0){ @initiatorname = Ops.get_string( - Convert.convert( - SCR.Execute( - path(".target.bash_output"), - Builtins.sformat( - "grep -v '^#' %1 | grep InitiatorName | cut -d'=' -f2 | tr -d '\n'", - file - ) - ), - :from => "any", - :to => "map <string, any>" + SCR.Execute( + path(".target.bash_output"), + Builtins.sformat( + "/usr/bin/grep -v '^#' %1 | /usr/bin/grep InitiatorName | /usr/bin/cut -d'=' -f2 | /usr/bin/tr -d '\n'", + file.shellescape + ) ), "stdout", "" @@ -683,27 +661,14 @@ @initiatorname = name_from_bios else Builtins.y2milestone("InitiatorName does not exist - generate it") - domain = Ops.get_string( - Convert.convert( - SCR.Execute(path(".target.bash_output"), ""), - :from => "any", - :to => "map <string, any>" - ), - "stdout", - "com.example" - ) - output = Convert.convert( - SCR.Execute( - path(".target.bash_output"), - Builtins.sformat( - "/sbin/iscsi-iname -p iqn.%1.%2:01 | tr -d '\n'", - "`date +%Y-%m`", - getReverseDomainName - ), - {} + output = SCR.Execute( + path(".target.bash_output"), + Builtins.sformat( + "/sbin/iscsi-iname -p iqn.%1.%2:01 | tr -d '\n'", + "`date +%Y-%m`", + getReverseDomainName.shellescape ), - :from => "any", - :to => "map <string, any>" + {} ) if Builtins.size(Ops.get_string(output, "stderr", "")) == 0 @initiatorname = Ops.get_string(output, "stdout", "") @@ -744,20 +709,16 @@ ret = true Builtins.y2milestone("Delete record %1", @currentRecord) - retcode = Convert.convert( - SCR.Execute( - path(".target.bash_output"), - GetAdmCmd( - Builtins.sformat( - "-m node -I %3 -T %1 -p %2 --logout", - Ops.get(@currentRecord, 1, ""), - Ops.get(@currentRecord, 0, ""), - Ops.get(@currentRecord, 2, "default") - ) + retcode = SCR.Execute( + path(".target.bash_output"), + GetAdmCmd( + Builtins.sformat( + "-m node -I %3 -T %1 -p %2 --logout", + Ops.get(@currentRecord, 1, "").shellescape, + Ops.get(@currentRecord, 0, "").shellescape, + Ops.get(@currentRecord, 2, "default").shellescape ) - ), - :from => "any", - :to => "map <string, any>" + ) ) if Ops.greater_than( Builtins.size(Ops.get_string(retcode, "stderr", "")), @@ -776,7 +737,7 @@ # converted to a hash def getCurrentNodeValues ret = SCR.Execute(path(".target.bash_output"), - GetAdmCmd("-m node -I #{@currentRecord[2] || "default"} -T #{@currentRecord[1] || ""} -p #{@currentRecord[0] || ""}")) + GetAdmCmd("-m node -I #{(@currentRecord[2] || "default").shellescape} -T #{(@currentRecord[1] || "").shellescape} -p #{(@currentRecord[0] || "").shellescape}")) return {} if ret["exit"] != 0 nodeInfoToMap(ret["stdout"] || "") @@ -842,20 +803,16 @@ Builtins.y2milestone("set %1 for record %2", name, rec) log = !name.include?("password") - cmd = "-m node -I #{rec[2] || "default"} -T #{rec[1] || ""} -p #{rec[0] || ""} --op=update --name=#{name}" + cmd = "-m node -I #{(rec[2] || "default").shellescape} -T #{(rec[1] || "").shellescape} -p #{(rec[0] || "").shellescape} --op=update --name=#{name.shellescape}" - command = GetAdmCmd("#{cmd} --value=#{value}", log) + command = GetAdmCmd("#{cmd} --value=#{value.shellescape}", log) if !log value = "*****" if !value.empty? Builtins.y2milestone("AdmCmd:LC_ALL=POSIX iscsiadm #{cmd} --value=#{value}") end ret = true - retcode = Convert.convert( - SCR.Execute(path(".target.bash_output"), command), - :from => "any", - :to => "map <string, any>" - ) + retcode = SCR.Execute(path(".target.bash_output"), command) if Ops.greater_than( Builtins.size(Ops.get_string(retcode, "stderr", "")), 0 @@ -946,21 +903,17 @@ status ) ret = true - retcode = Convert.convert( - SCR.Execute( - path(".target.bash_output"), - GetAdmCmd( - Builtins.sformat( - "-m node -I%3 -T %1 -p %2 --op=update --name=node.conn[0].startup --value=%4", - Ops.get(@currentRecord, 1, ""), - Ops.get(@currentRecord, 0, ""), - Ops.get(@currentRecord, 2, "default"), - status - ) + retcode = SCR.Execute( + path(".target.bash_output"), + GetAdmCmd( + Builtins.sformat( + "-m node -I%3 -T %1 -p %2 --op=update --name=node.conn[0].startup --value=%4", + Ops.get(@currentRecord, 1, "").shellescape, + Ops.get(@currentRecord, 0, "").shellescape, + Ops.get(@currentRecord, 2, "default").shellescape, + status.shellescape ) - ), - :from => "any", - :to => "map <string, any>" + ) ) if Ops.greater_than( Builtins.size(Ops.get_string(retcode, "stderr", "")), @@ -968,21 +921,17 @@ ) return false else - retcode = Convert.convert( - SCR.Execute( - path(".target.bash_output"), - GetAdmCmd( - Builtins.sformat( - "-m node -I %3 -T %1 -p %2 --op=update --name=node.startup --value=%4", - Ops.get(@currentRecord, 1, ""), - Ops.get(@currentRecord, 0, ""), - Ops.get(@currentRecord, 2, "default"), - status - ) + retcode = SCR.Execute( + path(".target.bash_output"), + GetAdmCmd( + Builtins.sformat( + "-m node -I %3 -T %1 -p %2 --op=update --name=node.startup --value=%4", + Ops.get(@currentRecord, 1, "").shellescape, + Ops.get(@currentRecord, 0, "").shellescape, + Ops.get(@currentRecord, 2, "default").shellescape, + status.shellescape ) - ), - :from => "any", - :to => "map <string, any>" + ) ) end @@ -994,8 +943,7 @@ ret = true log.info "begin of autoLogOn function" if !getiBFT.empty? - result = Convert.to_map(SCR.Execute(path(".target.bash_output"), - GetAdmCmd("-m fw -l"))) + result = SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m fw -l")) ret = false if result["exit"] != 0 log.info "Autologin into iBFT : #{result}" end @@ -1036,20 +984,16 @@ setValue("node.session.auth.authmethod", "None") end - output = Convert.convert( - SCR.Execute( - path(".target.bash_output"), - GetAdmCmd( - Builtins.sformat( - "-m node -I %3 -T %1 -p %2 --login", - Ops.get_string(target, "target", ""), - Ops.get_string(target, "portal", ""), - Ops.get_string(target, "iface", "") - ) + output = SCR.Execute( + path(".target.bash_output"), + GetAdmCmd( + Builtins.sformat( + "-m node -I %3 -T %1 -p %2 --login", + Ops.get_string(target, "target", "").shellescape, + Ops.get_string(target, "portal", "").shellescape, + Ops.get_string(target, "iface", "").shellescape ) - ), - :from => "any", - :to => "map <string, any>" + ) ) Builtins.y2internal("output %1", output) @@ -1179,8 +1123,8 @@ GetAdmCmd( Builtins.sformat( "-m discovery %1 -t st -p %2", - ifacepar, - Ops.get_string(target, "portal", "") + ifacepar.shellescape, + Ops.get_string(target, "portal", "").shellescape ) ) ) @@ -1254,11 +1198,7 @@ def InitOffloadCard ret = "default" - retcode = Convert.convert( - SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m node -P 1")), - :from => "any", - :to => "map <string, any>" - ) + retcode = SCR.Execute(path(".target.bash_output"), GetAdmCmd("-m node -P 1")) ifaces = [] if Builtins.size(Ops.get_string(retcode, "stderr", "")) == 0 Builtins.foreach( @@ -1293,16 +1233,9 @@ Builtins.y2milestone("InitIfaceFile files:%1", files) if files == nil || Builtins.size(files) == 0 cmd = GetAdmCmd("-m iface") - Builtins.y2milestone("InitIfaceFile cmd:%1", cmd) - Builtins.y2milestone( - "InitIfaceFile ret:%1", - SCR.Execute(path(".target.bash_output"), cmd) - ) - files = Convert.convert( - SCR.Read(path(".target.dir"), "/etc/iscsi/ifaces"), - :from => "any", - :to => "list <string>" - ) + res = SCR.Execute(path(".target.bash_output"), cmd) + Builtins.y2milestone("InitIfaceFile cmd:#{cmd}\nres:#{res.inspect}", cmd) + files = SCR.Read(path(".target.dir"), "/etc/iscsi/ifaces") Builtins.y2milestone("InitIfaceFile files:%1", files) end Builtins.foreach(files) do |file| @@ -1342,7 +1275,6 @@ end def GetOffloadItems - i = 0 init = false if @offload_valid == nil init = true @@ -1374,14 +1306,12 @@ idx = 0 Builtins.foreach(@offload) do |l| - valid = false mod = Convert.convert( Builtins.sort(Ops.get_list(l, 2, [])), :from => "list", :to => "list <string>" ) if Ops.greater_than(Builtins.size(mod), 0) - i = 0 Builtins.foreach(hw_mods) do |hw| if Ops.greater_than( Builtins.size( @@ -1427,13 +1357,7 @@ Builtins.filter( Convert.convert(eth, :from => "list", :to => "list <list>") ) do |l| - cmd = Ops.add( - Ops.add( - Ops.add(@offboard_script, " "), - Ops.get_string(l, 0, "") - ), - " | grep ..:..:..:.." # grep for lines containing MAC address - ) + cmd = "#{OFFLOAD_SCRIPT} #{Ops.get_string(l, 0, "").shellescape} | grep ..:..:..:.." # grep for lines containing MAC address Builtins.y2milestone("GetOffloadItems cmd:%1", cmd) out = Convert.to_map( SCR.Execute(path(".target.bash_output"), cmd) @@ -1441,15 +1365,13 @@ # Example for output if offload is supported on interface: # cmd: iscsi_offload eth2 # out: $["exit":0, "stderr":"", "stdout":"00:00:c9:b1:bc:7f ip \n"] + result = SCR.Execute( + path(".target.bash_output"), + "#{OFFLOAD_SCRIPT} #{Ops.get_string(l, 0, "").shellescape}" + ) Builtins.y2milestone( "GetOffloadItems iscsi_offload out:%1", - SCR.Execute( - path(".target.bash_output"), - Ops.add( - Ops.add(@offboard_script, " "), - Ops.get_string(l, 0, "") - ) - ) + result ) Ops.set(offload_res, Ops.get_string(l, 0, ""), {}) Ops.set( @@ -1506,14 +1428,10 @@ Ops.set( @offload_valid, i2, - Builtins.maplist( - Convert.convert(eth, :from => "list", :to => "list <list>") - ) do |l| - cmd = Ops.add("LC_ALL=POSIX ifconfig ", Ops.get_string(l, 0, "")) + Builtins.maplist(eth) do |l| + cmd = "LC_ALL=POSIX /usr/bin/ifconfig " + Ops.get_string(l, 0, "").shellescape # FIXME: ifconfig is deprecated Builtins.y2milestone("GetOffloadItems cmd:%1", cmd) - out = Convert.to_map( - SCR.Execute(path(".target.bash_output"), cmd) - ) + out = SCR.Execute(path(".target.bash_output"), cmd) Builtins.y2milestone("GetOffloadItems out:%1", out) # Search for lines containing "init addr", means IPv4 address. # Regarding the IPv6 support there are no changes needed here because @@ -1600,8 +1518,7 @@ end def GetOffloadModules - it = nil - it = GetOffloadItems() if @offload_valid == nil + GetOffloadItems() if @offload_valid == nil modules = [] Builtins.foreach(@offload_valid) do |i, _l| modules = Convert.convert( @@ -1657,12 +1574,9 @@ ) { |l| Ops.get_string(l, 2, "") == s } Builtins.y2milestone("CallConfigScript hw:%1", hw) if hw != nil - cmd = Ops.add( - Ops.add(@offboard_script, " "), - Ops.get_string(hw, 0, "") - ) + cmd = "#{OFFLOAD_SCRIPT} #{Ops.get_string(hw, 0, "").shellescape}" Builtins.y2milestone("CallConfigScript cmd:%1", cmd) - output = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) + output = SCR.Execute(path(".target.bash_output"), cmd) Builtins.y2milestone("CallConfigScript %1", output) end end
