upgrade.sh: fix message about venv #4460

Closed
opened 2025-12-29 18:36:12 +01:00 by adam · 7 comments
Owner

Originally created by @pvinci on GitHub (Jan 13, 2021).

Environment

  • Python version: 3.8
  • NetBox version: develop

Steps to Reproduce

  1. ./upgrade.sh

Expected Behavior


WARNING: No existing virtual environment was detected. A new one has
been created. Update your systemd service files to reflect the new
Python and gunicorn executables. (If this is a new installation,
this warning can be ignored.)

netbox.service ExecStart:
/Users/pvinci/netbox/venv/bin/gunicorn

netbox-rq.service ExecStart:
/Users/pvinci/netbox/venv/bin/python

After modifying these files, reload the systemctl daemon:

systemctl daemon-reload


Upgrade complete! Don't forget to restart the NetBox services:

sudo systemctl restart netbox netbox-rq

Observed Behavior

./upgrade.sh: line 83: [: -v: unary operator expected
Upgrade complete! Don't forget to restart the NetBox services:

sudo systemctl restart netbox netbox-rq

Originally created by @pvinci on GitHub (Jan 13, 2021). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reporting reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, please start a discussion instead: https://github.com/netbox-community/netbox/discussions Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.8 * NetBox version: develop <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. ./upgrade.sh 2. 3. <!-- What did you expect to happen? --> ### Expected Behavior -------------------------------------------------------------------- WARNING: No existing virtual environment was detected. A new one has been created. Update your systemd service files to reflect the new Python and gunicorn executables. (If this is a new installation, this warning can be ignored.) netbox.service ExecStart: /Users/pvinci/netbox/venv/bin/gunicorn netbox-rq.service ExecStart: /Users/pvinci/netbox/venv/bin/python After modifying these files, reload the systemctl daemon: > systemctl daemon-reload -------------------------------------------------------------------- Upgrade complete! Don't forget to restart the NetBox services: > sudo systemctl restart netbox netbox-rq <!-- What happened instead? --> ### Observed Behavior ./upgrade.sh: line 83: [: -v: unary operator expected Upgrade complete! Don't forget to restart the NetBox services: > sudo systemctl restart netbox netbox-rq
adam added the pending closure label 2025-12-29 18:36:12 +01:00
adam closed this issue 2025-12-29 18:36:12 +01:00
Author
Owner

@yaoqitt1 commented on GitHub (Jan 13, 2021):

Skipping local dependencies (local_requirements.txt not found)
Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
File "netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/init.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/commands/migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 53, in init
self.build_graph()
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 210, in build_graph
self.load_disk()
File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 112, in load_disk
migration_module = import_module(migration_path)
File "/usr/lib64/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/opt/netbox/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 36, in
class Migration(migrations.Migration):
File "/opt/netbox/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 127, in Migration
('image', models.ImageField(height_field='image_height', upload_to=extras.models.image_upload, width_field='image_width')),
AttributeError: module 'extras.models' has no attribute 'image_upload'

@yaoqitt1 commented on GitHub (Jan 13, 2021): Skipping local dependencies (local_requirements.txt not found) Applying database migrations (python3 netbox/manage.py migrate)... Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped res = handle_func(*args, **kwargs) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/core/management/commands/migrate.py", line 92, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 53, in __init__ self.build_graph() File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 210, in build_graph self.load_disk() File "/opt/netbox/venv/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 112, in load_disk migration_module = import_module(migration_path) File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/opt/netbox/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 36, in <module> class Migration(migrations.Migration): File "/opt/netbox/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 127, in Migration ('image', models.ImageField(height_field='image_height', upload_to=extras.models.image_upload, width_field='image_width')), AttributeError: module 'extras.models' has no attribute 'image_upload'
Author
Owner

@pvinci commented on GitHub (Jan 13, 2021):

@yaoqitt1 I don't understand your comment.

@pvinci commented on GitHub (Jan 13, 2021): @yaoqitt1 I don't understand your comment.
Author
Owner

@DanSheps commented on GitHub (Jan 13, 2021):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v2.10.3. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@DanSheps commented on GitHub (Jan 13, 2021): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v2.10.3. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.
Author
Owner

@pvinci commented on GitHub (Jan 13, 2021):

@DanSheps
I looked at this further and the command in the original commit is correct for systems with bash>=4.2. Is it better to support older versions of bash, or document the dependency somewhere?

@pvinci commented on GitHub (Jan 13, 2021): @DanSheps I looked at this further and the command in the original commit is correct for systems with bash>=4.2. Is it better to support older versions of bash, or document the dependency somewhere?
Author
Owner

@DanSheps commented on GitHub (Jan 13, 2021):

What is the OS you.are running on?

@DanSheps commented on GitHub (Jan 13, 2021): What is the OS you.are running on?
Author
Owner

@pvinci commented on GitHub (Jan 13, 2021):

osx Catalina

bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)

@pvinci commented on GitHub (Jan 13, 2021): osx Catalina bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Author
Owner

@DanSheps commented on GitHub (Jan 13, 2021):

macOS is not an officially supported version. We build against CentOS, and Ubuntu non-EOL versions. These all include Bash4.2. My suggestion would be to run a docker container to test netbox if you need.

@DanSheps commented on GitHub (Jan 13, 2021): macOS is not an officially supported version. We build against CentOS, and Ubuntu non-EOL versions. These all include Bash4.2. My suggestion would be to run a docker container to test netbox if you need.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4460