From ca47764836e44480d1807e0c07f1e3815c49556e Mon Sep 17 00:00:00 2001 From: Terrtia Date: Wed, 19 Dec 2018 15:16:52 +0100 Subject: [PATCH] fix: [update v1.5] --- bin/Update.py | 19 ++++++++++++------- update/v1.5/Update.py | 7 ++----- update/v1.5/Update.sh | 2 ++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/Update.py b/bin/Update.py index cc7cb7d1..f9cfbd9e 100755 --- a/bin/Update.py +++ b/bin/Update.py @@ -25,7 +25,6 @@ def auto_update_enabled(cfg): # check if files are modify locally def check_if_files_modified(): process = subprocess.run(['git', 'ls-files' ,'-m'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if process.returncode == 0: modified_files = process.stdout if modified_files: @@ -197,7 +196,7 @@ def get_git_upper_tags_remote(current_tag, is_fork): def update_ail(current_tag, list_upper_tags_remote, current_version_path, is_fork): print('{}git checkout master:{}'.format(TERMINAL_YELLOW, TERMINAL_DEFAULT)) process = subprocess.run(['git', 'checkout', 'master'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - + #process = subprocess.run(['ls'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if process.returncode == 0: print(process.stdout.decode()) print() @@ -260,10 +259,16 @@ def launch_update_version(version, roll_back_commit, current_version_path, is_fo print('{}------------------------------------------------------------------'.format(TERMINAL_YELLOW)) print('- Launching Update: {}{}{} -'.format(TERMINAL_BLUE, version, TERMINAL_YELLOW)) print('-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --{}'.format(TERMINAL_DEFAULT)) - process = subprocess.run(['bash', update_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(['bash', update_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + while True: + output = process.stdout.readline().decode() + if output == '' and process.poll() is not None: + break + if output: + print(output.strip()) if process.returncode == 0: - output = process.stdout.decode() - print(output) + #output = process.stdout.decode() + #print(output) with open(current_version_path, 'w') as version_content: version_content.write(version) @@ -273,8 +278,8 @@ def launch_update_version(version, roll_back_commit, current_version_path, is_fo print('------------------------------------------------------------------{}'.format(TERMINAL_DEFAULT)) print() else: - print(process.stdout.decode()) - print('{}{}{}'.format(TERMINAL_RED, process.stderr.decode(), TERMINAL_DEFAULT)) + #print(process.stdout.read().decode()) + print('{}{}{}'.format(TERMINAL_RED, process.stderr.read().decode(), TERMINAL_DEFAULT)) print('------------------------------------------------------------------') print(' {}Update Error: {}{}{}'.format(TERMINAL_RED, TERMINAL_BLUE, version, TERMINAL_DEFAULT)) print('------------------------------------------------------------------') diff --git a/update/v1.5/Update.py b/update/v1.5/Update.py index 2622976f..6a75b47a 100755 --- a/update/v1.5/Update.py +++ b/update/v1.5/Update.py @@ -142,11 +142,8 @@ if __name__ == '__main__': for key in r_serv_metadata.scan_iter(key_to_rename): new_key = key.replace(PASTES_FOLDER, '', 1) # a hset with this key already exist - if r_serv_metadata.exists(new_key): - print(key) - else: - keys_to_rename.append((key, new_key)) - index = index + 1 + keys_to_rename.append((key, new_key)) + index = index + 1 for key, new_key in keys_to_rename: r_serv_metadata.rename(key, new_key) keys_to_rename = None diff --git a/update/v1.5/Update.sh b/update/v1.5/Update.sh index f329c7c5..3cc45f01 100755 --- a/update/v1.5/Update.sh +++ b/update/v1.5/Update.sh @@ -30,6 +30,8 @@ while $flag_ardb; do fi done +echo "" +echo "Fixing ARDB ..." echo "" bash -c "python ${AIL_HOME}/update/v1.5/Update.py"