From e4b9fe765e912a13ff02a394b329ecd117a0edb7 Mon Sep 17 00:00:00 2001 From: efedorova Date: Tue, 15 Oct 2013 19:03:09 +0400 Subject: [PATCH] Fix buf with manifests listing --- etc/murano-repository.conf | 5 ++--- muranorepository/api/v1.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/etc/murano-repository.conf b/etc/murano-repository.conf index f419334..6b0ea01 100644 --- a/etc/murano-repository.conf +++ b/etc/murano-repository.conf @@ -1,8 +1,7 @@ [DEFAULT] # Address to bind the server to -host = 127.0.0.1 - -# Port the bind the server to +host = 172.18.10.111 +#Port the bind the server to port = 5000 diff --git a/muranorepository/api/v1.py b/muranorepository/api/v1.py index 0ad610b..5ace695 100644 --- a/muranorepository/api/v1.py +++ b/muranorepository/api/v1.py @@ -55,16 +55,20 @@ def get_data_type_locations(data_type): ####### end validation ######## if request.method == 'GET': locations = [] - - for path, subdirs, files in os.walk(result_path): - for name in files: - locations.append(name) + if data_type == MANIFEST: + for item in os.listdir(result_path): + if '-manifest' in item: + locations.append(item) + else: + for path, subdirs, files in os.walk(result_path): + for name in files: + locations.append(name) result = {data_type: locations} return jsonify(result) if request.method == 'POST': try: - file_to_upload = request.files['files'] + file_to_upload = request.files.get('files') if file_to_upload: filename = secure_filename(file_to_upload.filename) file_to_upload.save(os.path.join(result_path, filename))