From c4a536a18f46cae82c0c5943b68715bdbaea237b Mon Sep 17 00:00:00 2001 From: penguhyang Date: Mon, 22 Aug 2016 13:39:09 +0800 Subject: [PATCH] use the same way to promote error msg (#1749) --- xCAT-server/lib/xcat/plugins/packimage.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 216e21ae1..c1963d207 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -417,7 +417,6 @@ sub process_request { $callback->({ error => ["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"] }); return 1; } - $callback->({ data => ["Packing contents of $rootimg_dir"] }); my $suffix; if ($compress) { @@ -462,6 +461,11 @@ sub process_request { $suffix = "gz"; } + unless (($method eq 'cpio') or ($method eq 'tar') or ($method eq 'squashfs')) { + $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); + return 1; + } + $callback->({ data => ["Packing contents of $rootimg_dir"] }); $callback->({ info => ["archive method:$method"] }); unless ($method =~ /squashfs/) { $callback->({ info => ["compress method:$compress"] }); @@ -517,9 +521,6 @@ sub process_request { system("$includestr >> $xcat_packimg_tmpfile"); } $excludestr = "cat $xcat_packimg_tmpfile|cpio -dump $temppath"; - } else { - $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); - return 1; } chdir("$rootimg_dir");