summaryrefslogtreecommitdiffstats
path: root/catalog/pub
diff options
context:
space:
mode:
authordyh <dengyuanhong@chinamobile.com>2019-10-30 15:15:56 +0800
committerdyh <dengyuanhong@chinamobile.com>2019-10-30 15:22:12 +0800
commit0b6a49e188b44602ca83a5802b6820b32d3e2a35 (patch)
treec7c6c9e67264e89b0e9aaaf8ca73d9da22bb69f0 /catalog/pub
parentfec58589e6c2493b83743ed35a26b3e76ac996a4 (diff)
Get original vendor package under the ONBOARDING_PACKAGE directory from SDC resource CSAR
Change-Id: I50b346f6f709140363fc86684b1142fb28344a72 Signed-off-by: dyh <dengyuanhong@chinamobile.com> Issue-ID: MODELING-265
Diffstat (limited to 'catalog/pub')
-rw-r--r--catalog/pub/utils/fileutil.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/catalog/pub/utils/fileutil.py b/catalog/pub/utils/fileutil.py
index 6ddfc72..9344f72 100644
--- a/catalog/pub/utils/fileutil.py
+++ b/catalog/pub/utils/fileutil.py
@@ -19,7 +19,6 @@ import traceback
import urllib
import zipfile
-
logger = logging.getLogger(__name__)
@@ -64,6 +63,17 @@ def unzip_file(zip_src, dst_dir, csar_path):
return ""
+def unzip_csar(zip_src, dst_dir):
+ if os.path.exists(zip_src):
+ fz = zipfile.ZipFile(zip_src, 'r')
+ for file in fz.namelist():
+ fz.extract(file, dst_dir)
+ return dst_dir
+ else:
+ logger.error("%s doesn't exist", zip_src)
+ return ""
+
+
def unzip_csar_to_tmp(zip_src):
dirpath = tempfile.mkdtemp()
zip_ref = zipfile.ZipFile(zip_src, 'r')