From 017ab78ba555ba7323913ad992e8031bc02abb6e Mon Sep 17 00:00:00 2001 From: cxhong Date: Tue, 9 Oct 2018 01:49:15 -0400 Subject: [PATCH] Failed to parse the prescripts without action defined (#5682) --- xCAT-server/lib/xcat/plugins/prescripts.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/prescripts.pm b/xCAT-server/lib/xcat/plugins/prescripts.pm index 36fbf64b7..08bdf780d 100644 --- a/xCAT-server/lib/xcat/plugins/prescripts.pm +++ b/xCAT-server/lib/xcat/plugins/prescripts.pm @@ -426,21 +426,19 @@ sub parseprescripts my $scripts = shift; my $action = shift; my $ret; - if ($scripts) { - if ($scripts =~ /:/) { - my @a = split(/\|/, $scripts); - foreach my $token (@a) { - #print "token=$token, action=$action\n"; + if ($scripts) { + foreach my $token (split(/\|/, $scripts)) { + if ($token =~ /:/) { if ($token =~ /^$action:(.*)/) { - $ret = $1; - last; + $ret .= "$1,"; } + } else { + $ret .= "$token,"; } - } else { - $ret = $scripts; } } + return $ret; }