Merge "Use Python3 based http.server command"

This commit is contained in:
Zuul
2022-01-19 10:10:01 +00:00
committed by Gerrit Code Review

View File

@@ -15,15 +15,10 @@ priority=1
EOF
{% if ib_create_web_repo|bool %}
ps -ef | grep -i python | grep SimpleHTTPServer | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
ps -ef | grep -i python3 | grep http.server | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
pushd /opt/gating_repo
iptables -I INPUT -p tcp --dport 8766 -j ACCEPT
if command -v python3
then
nohup python3 -m http.server 8766 1>{{ working_dir }}/pkg_mgr_mirror.log 2>{{ working_dir }}/pkg_mgr_mirror_error.log &
else
nohup python -m SimpleHTTPServer 8766 1>{{ working_dir }}/pkg_mgr_mirror.log 2>{{ working_dir }}/pkg_mgr_mirror_error.log &
fi
nohup python3 -m http.server 8766 1>{{ working_dir }}/pkg_mgr_mirror.log 2>{{ working_dir }}/pkg_mgr_mirror_error.log &
popd
cat > {{ working_dir }}//web-gating.repo << EOF
[gating-repo]