mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-26 17:54:05 +00:00
fix(xcat-core): the otherpkgs url repository guard tests a literal string
Line 672 of xCAT/postscripts/otherpkgs reads [ -n "OTHERPKGDIR_INTERNET" ]. The $ is missing, so the test is on the name of the variable and is always true. The guard cannot select the case it was written for. The guard now tests $OTHERPKGDIR_INTERNET. postscripts_otherpkgs.bats extracts the condition from the script and runs it with the variable empty and with an http entry. Against the unfixed script the empty case is true. The block is inert when the variable is empty, because the loop inside it iterates an empty array, so the run of the postscript does not change. The guard is still wrong. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -221,3 +221,18 @@ run_repo_postremove_block()
|
||||
[ "$status" -eq 0 ]
|
||||
grep -q 'oldfoo removed\.' "$LOGGER_LOG"
|
||||
}
|
||||
|
||||
@test "the url repository guard is false when OTHERPKGDIR has no http entry" {
|
||||
local guard cond
|
||||
guard="$(extract_first_matching_line "$OTHERPKGS" 'OTHERPKGDIR_INTERNET" *[]] *; *then')" || return 99
|
||||
cond="${guard#*if }"
|
||||
cond="${cond%%;then*}"
|
||||
|
||||
OTHERPKGDIR_INTERNET=""
|
||||
run eval "$cond"
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
OTHERPKGDIR_INTERNET="http://192.0.2.1/repo,"
|
||||
run eval "$cond"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do
|
||||
|
||||
urlrepoindex=0
|
||||
#add repo for url repos in otherpkgdir
|
||||
if [ -n "OTHERPKGDIR_INTERNET" ];then
|
||||
if [ -n "$OTHERPKGDIR_INTERNET" ];then
|
||||
OIFS=$IFS
|
||||
IFS=','
|
||||
OTHERPKGDIRLIST_INTERNET=($OTHERPKGDIR_INTERNET)
|
||||
|
||||
Reference in New Issue
Block a user