From ff14fe6279a21923099a8a1b80420d04b414f1e1 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Fri, 26 Apr 2019 10:22:02 +0200 Subject: [PATCH] fix: [submit paste] remove item full path, use rel path --- bin/submit_paste.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/submit_paste.py b/bin/submit_paste.py index f2d468a2..34009774 100755 --- a/bin/submit_paste.py +++ b/bin/submit_paste.py @@ -36,15 +36,18 @@ def create_paste(uuid, paste_content, ltags, ltagsgalaxies, name): abord_file_submission(uuid, "file error") return 1 + # use relative path + rel_item_path = save_path.replace(PASTES_FOLDER, '', 1) + # send paste to Global module - relay_message = "{0} {1}".format(save_path, gzip64encoded) + relay_message = "{0} {1}".format(rel_item_path, gzip64encoded) p.populate_set_out(relay_message, 'Mixer') # increase nb of paste by feeder name r_serv_log_submit.hincrby("mixer_cache:list_feeder", "submitted", 1) # add tags - add_tags(ltags, ltagsgalaxies, full_path) + add_tags(ltags, ltagsgalaxies, rel_item_path) r_serv_log_submit.incr(uuid + ':nb_end') r_serv_log_submit.incr(uuid + ':nb_sucess') @@ -52,8 +55,8 @@ def create_paste(uuid, paste_content, ltags, ltagsgalaxies, name): if r_serv_log_submit.get(uuid + ':nb_end') == r_serv_log_submit.get(uuid + ':nb_total'): r_serv_log_submit.set(uuid + ':end', 1) - print(' {} send to Global'.format(save_path)) - r_serv_log_submit.sadd(uuid + ':paste_submit_link', full_path) + print(' {} send to Global'.format(rel_item_path)) + r_serv_log_submit.sadd(uuid + ':paste_submit_link', rel_item_path) curr_date = datetime.date.today() serv_statistics.hincrby(curr_date.strftime("%Y%m%d"),'submit_paste', 1) @@ -206,6 +209,8 @@ if __name__ == "__main__": config_section = 'submit_paste' p = Process(config_section) + PASTES_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "pastes")) + '/' + while True: # paste submitted