Closes #2594: upgrade.sh no longer invokes sudo

This commit is contained in:
Jeremy Stretch 2018-11-30 11:12:10 -05:00
parent 08b4b24296
commit a1a9396287
2 changed files with 9 additions and 13 deletions

View File

@ -14,6 +14,10 @@ The UserAction model, which was deprecated by the new change logging feature in
Django 2.1 introduces view permissions for object types (not to be confused with object-level permissions). Implementation of [#323](https://github.com/digitalocean/netbox/issues/323) is planned for NetBox v2.6. Users are encourage to begin assigning view permissions as desired in preparation for their eventual enforcement. Django 2.1 introduces view permissions for object types (not to be confused with object-level permissions). Implementation of [#323](https://github.com/digitalocean/netbox/issues/323) is planned for NetBox v2.6. Users are encourage to begin assigning view permissions as desired in preparation for their eventual enforcement.
### upgrade.sh No Longer Invokes sudo
The `upgrade.sh` script has been tweaked so that it no longer invokes `sudo` internally. This was done to ensure compatibility when running NetBox inside a Python virtual environment. If you need elevated permissions when upgrading NetBox, call the upgrade script with `sudo upgrade.sh`.
## New Features ## New Features
### Patch Panels and Cables ([#20](https://github.com/digitalocean/netbox/issues/20)) ### Patch Panels and Cables ([#20](https://github.com/digitalocean/netbox/issues/20))
@ -34,6 +38,7 @@ NetBox now supports modeling physical cables for console, power, and interface c
* [#2292](https://github.com/digitalocean/netbox/issues/2292) - Removed the deprecated UserAction model * [#2292](https://github.com/digitalocean/netbox/issues/2292) - Removed the deprecated UserAction model
* [#2367](https://github.com/digitalocean/netbox/issues/2367) - Removed deprecated RPCClient functionality * [#2367](https://github.com/digitalocean/netbox/issues/2367) - Removed deprecated RPCClient functionality
* [#2426](https://github.com/digitalocean/netbox/issues/2426) - Introduced `SESSION_FILE_PATH` configuration setting for authentication without write access to database * [#2426](https://github.com/digitalocean/netbox/issues/2426) - Introduced `SESSION_FILE_PATH` configuration setting for authentication without write access to database
* [#2594](https://github.com/digitalocean/netbox/issues/2594) - `upgrade.sh` no longer invokes sudo
## Changes From v2.5-beta2 ## Changes From v2.5-beta2

View File

@ -8,28 +8,19 @@
PYTHON="python3" PYTHON="python3"
PIP="pip3" PIP="pip3"
# Optionally use sudo if not already root, and always prompt for password # TODO: Remove this in v2.6 as it is no longer needed under Python 3
# before running the command
PREFIX="sudo -k "
if [ "$(whoami)" = "root" ]; then
# When running upgrade as root, ask user to confirm if they wish to
# continue
read -n1 -rsp $'Running NetBox upgrade as root, press any key to continue or ^C to cancel\n'
PREFIX=""
fi
# Delete stale bytecode # Delete stale bytecode
COMMAND="${PREFIX}find . -name \"*.pyc\" -delete" COMMAND="find . -name \"*.pyc\" -delete"
echo "Cleaning up stale Python bytecode ($COMMAND)..." echo "Cleaning up stale Python bytecode ($COMMAND)..."
eval $COMMAND eval $COMMAND
# Uninstall any Python packages which are no longer needed # Uninstall any Python packages which are no longer needed
COMMAND="${PREFIX}${PIP} uninstall -r old_requirements.txt -y" COMMAND="${PIP} uninstall -r old_requirements.txt -y"
echo "Removing old Python packages ($COMMAND)..." echo "Removing old Python packages ($COMMAND)..."
eval $COMMAND eval $COMMAND
# Install any new Python packages # Install any new Python packages
COMMAND="${PREFIX}${PIP} install -r requirements.txt --upgrade" COMMAND="${PIP} install -r requirements.txt --upgrade"
echo "Updating required Python packages ($COMMAND)..." echo "Updating required Python packages ($COMMAND)..."
eval $COMMAND eval $COMMAND