Fix function package update

Change-Id: I534978de7ccc65f00ca09e32eddc1b829af47925
changes/92/522992/1
Lingxian Kong 6 years ago
parent 3720db0ed6
commit c22dac0df1

@ -46,14 +46,17 @@ class FileSystemStorage(base.PackageStorage):
project_path = os.path.join(CONF.storage.file_system_dir, project_id)
fileutils.ensure_tree(project_path)
new_func_zip = os.path.join(project_path, '%s.zip.new' % function)
func_zip = os.path.join(project_path, '%s.zip' % function)
with open(func_zip, 'wb') as fd:
with open(new_func_zip, 'wb') as fd:
fd.write(data)
if not zipfile.is_zipfile(func_zip):
fileutils.delete_if_exists(func_zip)
if not zipfile.is_zipfile(new_func_zip):
fileutils.delete_if_exists(new_func_zip)
raise exc.InputException("Package is not a valid ZIP package.")
os.rename(new_func_zip, func_zip)
def retrieve(self, project_id, function):
"""Get function package data.

Loading…
Cancel
Save