__netbox: kill all running venv processes

To avoid aborts because of the python venv could not be updated by
killing all processes that uses the venv.

It will be done all times to prevent any error, because it could not be
reliably detected if the type installs or updates NetBox.
This commit is contained in:
matze 2020-09-05 13:53:05 +02:00
parent af91b6e3a1
commit 314a0d4d8e

View file

@ -30,6 +30,17 @@ tar xf '$archive'
cp '$install_dir/cdist/configuration.py' "\$tmpdir/configuration.py" cp '$install_dir/cdist/configuration.py' "\$tmpdir/configuration.py"
cp '$install_dir/cdist/ldap_config.py' "\$tmpdir/ldap_config.py" cp '$install_dir/cdist/ldap_config.py' "\$tmpdir/ldap_config.py"
EOF
# Stop everything in the pyenv to update
cat << EOF
# Try to kill everything in the venv
systemctl stop netbox gunicorn-netbox uwsgi-netbox || true
ps -axo pid,cmd | awk '\$2 ~ "^/opt/netbox/venv/"{print \$1}' | xargs kill || true
EOF
cat << EOF
# Deploy sources and restore configuration. # Deploy sources and restore configuration.
rm -r '$install_dir' rm -r '$install_dir'
cp -r '$src/netbox' '$install_dir' cp -r '$src/netbox' '$install_dir'