diff --git a/initial/base_config/script/upload.py b/initial/base_config/script/upload.py index aed76371313752d2935f5caf74b7f36340501957..81a8db5ddc70a1a51e8dbbde14210f6e534bdbad 100644 --- a/initial/base_config/script/upload.py +++ b/initial/base_config/script/upload.py @@ -13,7 +13,6 @@ OSS_RESULT_FOLDER=$4 CONF_SHORT_NAME=$5 TONE_STORAGE_BUCKET=${{6:-results}} - TONE_STORAGE_HOST={tone_storage_host} TONE_STORAGE_SFTP_PORT={tone_storage_sftp_port} TONE_STORAGE_PROXY_PORT={tone_storage_proxy_port} @@ -26,12 +25,24 @@ TONE_RESULT_PATH=$TONE_PATH/result/$TEST_SUITE/$CONF_SHORT_NAME TONE_RESULT_PATH_LEN=$((${{#TONE_RESULT_PATH}}+1)) SFTP_PARAMS="set sftp:auto-confirm yes; set net:timeout 60; set net:reconnect-interval-base 10; set net:max-retries 2" -install_utils() +function install_utils() {{ - yum install -y lftp >> $ALL_LOG 2>&1 + if command -v yum > /dev/null 2>&1; then + yum install -y lftp >> $ALL_LOG 2>&1 + elif command -v apt > /dev/null 2>&1; then + apt update >> $ALL_LOG 2>&1 + apt install -y lftp >> $ALL_LOG 2>&1 + elif command -v apt-get > /dev/null 2>&1; then + apt-get update >> $ALL_LOG 2>&1 + apt-get install -y lftp >> $ALL_LOG 2>&1 + else + echo "Unsupported package manager." >> $ALL_LOG 2>&1 + exit 1 + fi }} -function upload_file(){{ +function upload_file() +{{ file=$1 new_file=$2 folder=$3 diff --git a/initial/base_config/script/upload_file.py b/initial/base_config/script/upload_file.py index ceaa60b446dd773b3a0abcdbd60c307de3b97ebf..22e54c2e856284c0f0c5ad59054cd44937a35686 100644 --- a/initial/base_config/script/upload_file.py +++ b/initial/base_config/script/upload_file.py @@ -17,13 +17,24 @@ TONE_STORAGE_USER={tone_storage_user} TONE_STORAGE_PASSWORD={tone_storage_password} TONE_STORAGE_BUCKET=${{7:-results}} -install_utils() +function install_utils() {{ - yum install -y lftp + if command -v yum > /dev/null 2>&1; then + yum install -y lftp + elif command -v apt > /dev/null 2>&1; then + apt update + apt install -y lftp + elif command -v apt-get > /dev/null 2>&1; then + apt-get update + apt-get install -y lftp + else + echo "Unsupported package manager." >&2 + exit 1 + fi }} - -function upload_file(){{ +function upload_file() +{{ lftp -u ${{TONE_STORAGE_USER}},${{TONE_STORAGE_PASSWORD}} -e "set sftp:auto-confirm yes" sftp://${{TONE_STORAGE_HOST}}:${{TONE_STORAGE_SFTP_PORT}} <