fix: Handle answer files without product keys (#2097)

This commit is contained in:
Kroese
2026-08-07 06:40:13 +02:00
committed by GitHub
parent 803377ac3c
commit 751fae1343
+9 -1
View File
@@ -1198,7 +1198,15 @@ removeEmbeddedProductKeys() {
local product_keys='//u:ProductKey' local product_keys='//u:ProductKey'
local separator=$'\x1f' delete_xpath="" local separator=$'\x1f' delete_xpath=""
local records position child_key direct_key local count records position child_key direct_key
count=$(xmlstarlet sel \
-N "$XML_NS_UNATTEND_ARG" -T -t \
-v "count($product_keys)" \
"$asset") || return 1
[[ "$count" =~ ^[0-9]+$ ]] || return 1
(( count == 0 )) && return 0
records=$(xmlstarlet sel \ records=$(xmlstarlet sel \
-N "$XML_NS_UNATTEND_ARG" -T -t \ -N "$XML_NS_UNATTEND_ARG" -T -t \