Add csar path create logic for catalog 77/19877/1
authorfujinhua <fu.jinhua@zte.com.cn>
Fri, 20 Oct 2017 07:06:20 +0000 (15:06 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Fri, 20 Oct 2017 07:06:20 +0000 (15:06 +0800)
Change-Id: I5ab05b76dd94eeb14724a0fc3f50011ba496ffa1
Issue-Id: VFC-547
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
catalog/pub/msapi/sdc.py

index 8cf5632..147eedd 100644 (file)
@@ -18,6 +18,7 @@ import os
 
 from catalog.pub.exceptions import CatalogException
 from catalog.pub.utils import restcall
+from catalog.pub.utils import fileutil
 from catalog.pub.config.config import SDC_BASE_URL, SDC_USER, SDC_PASSWD
 
 logger = logging.getLogger(__name__)
@@ -102,6 +103,7 @@ def download_artifacts(download_url, local_path, file_name):
     if ret[0] != 0:
         logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
         raise CatalogException("Failed to download %s from sdc." % download_url)
+    fileutil.make_dirs(local_path)
     local_file_name = os.path.join(local_path, file_name)
     local_file = open(local_file_name, 'wb')
     local_file.write(ret[1])