Commit b54e9b2a authored by Alain Takoudjou's avatar Alain Takoudjou

Stork: fix previous commit

parent aca5d6ec
...@@ -181,31 +181,33 @@ class AppSubmit(GenericBaseRecipe): ...@@ -181,31 +181,33 @@ class AppSubmit(GenericBaseRecipe):
stork_submit = os.path.join(self.options['bin'].strip(), 'stork_submit') stork_submit = os.path.join(self.options['bin'].strip(), 'stork_submit')
file_list = '{}' file_list = '{}'
if str(self.options.get('src_from_file')).lower() in ['y', 'yes', '1', 'true'] \ if str(self.options.get('src_from_file')).lower() in ['y', 'yes', '1', 'true']:
and os.path.exists(source_url_list): if os.path.exists(source_url_list):
with open(source_url_list, 'r') as file_source: with open(source_url_list, 'r') as file_source:
file_list = json.loads(file_source.read()) file_list = json.loads(file_source.read())
else: else:
file_list = json.loads(source_url_list) file_list = json.loads(source_url_list)
with open(submitfile, 'w') as stork_file: with open(submitfile, 'w') as stork_file:
# XXX - Simply, we don't want to download file twice with stork, # XXX - Simply, we don't want to download file twice with stork,
# skip file if it already exists at dest_url (only for file:path) # skip file if it already exists at dest_url (only for file:path)
for filename in file_list: for filename in file_list:
log_name = filename
if dest_url.startswith('file:'): if dest_url.startswith('file:'):
destination = os.path.join(dest_url.replace('file:', ''), filename) destination = os.path.join(dest_url.replace('file:', ''), filename)
if os.path.exists(destination+'_part') or os.path.exists(destination): if os.path.exists(destination+'_part') or os.path.exists(destination):
continue continue
download_dest_list[filename] = destination download_dest_list[filename] = destination
filename = filename + '_part'
stork_file.write("""[ stork_file.write("""[
src_url="%s"; src_url="%s";
dest_url="%s/%s_part"; dest_url="%s/%s";
err = "%s.err"; err = "%s.err";
output = "%s.out"; output = "%s.out";
dap_type = "transfer"; dap_type = "transfer";
set_permission = "600" ; set_permission = "600" ;
] ]
""" % (file_list[filename], dest_url, filename, filename, filename) """ % (file_list[filename], dest_url, filename, log_name, log_name)
) )
parameter = dict(submit=stork_submit, parameter = dict(submit=stork_submit,
......
[buildout] [buildout]
develop =
${:parts-directory}/slapos.cookbook-repository
parts = parts =
stork stork
slapos-cookbook slapos-cookbook
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment