aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-10-20 15:06:20 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-10-20 15:06:20 +0800
commit49723a6d6cecbbb4812f377e19bc924c138d1831 (patch)
tree0cb2cb437bde7b108ee3480e6a05ff9fb5b225a0
parent2695ff151cde21700ff8c78c1cf926bf1a33739e (diff)
Add csar path create logic for catalog
Change-Id: I5ab05b76dd94eeb14724a0fc3f50011ba496ffa1 Issue-Id: VFC-547 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--catalog/pub/msapi/sdc.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/catalog/pub/msapi/sdc.py b/catalog/pub/msapi/sdc.py
index 8cf56324..147eedd5 100644
--- a/catalog/pub/msapi/sdc.py
+++ b/catalog/pub/msapi/sdc.py
@@ -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])