diff --git a/xCAT-test/bats/postscripts_otherpkgs.bats b/xCAT-test/bats/postscripts_otherpkgs.bats index 0883cacb7..4dc227d59 100644 --- a/xCAT-test/bats/postscripts_otherpkgs.bats +++ b/xCAT-test/bats/postscripts_otherpkgs.bats @@ -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 ] +} diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index d3018eb7d..0d66899ca 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -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)