How to upgrade from old version of netbox

2,842 views
Skip to first unread message

johnarvi...@gmail.com

unread,
Aug 9, 2017, 9:08:57 AM8/9/17
to NetBox
Hello,

I have tried a bit but wanted to ask the mailing list on what would be a good way to upgrade a old version of netbox (1.9.5) to the newest version (2.1.2).

I tried to simply download the newest release and run upgrade.sh but this ended in a "AttributeError: 'module' object has no attribute 'SSL_ST_INIT'"
Then I tried (after a snapshot restore of my vm) to upgrade to 1.9.6, but this ended in a Internal Server Error.

How should I proceed? I don't like that every time I need to upgrade I get stuck troubleshooting.
Other than that netbox is a great tool! Love the job that is being done.

/John

johnarvi...@gmail.com

unread,
Aug 9, 2017, 9:25:18 AM8/9/17
to NetBox
Tried to add pyOpenSSL==16.2.0 
to requirements.txt but then I got 
Collecting static files (python netbox/manage.py collectstatic --no-input)...
Traceback (most recent call last):
  File "netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 337, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 116, in populate
    app_config.ready()
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 23, in ready
    self.module.autodiscover()
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/dcim/admin.py", line 6, in <module>
    from .models import (
ImportError: cannot import name Module


Would it be easier to have a backup of the db, start a new netbox install and import?

/John

Jeremy Stretch

unread,
Aug 9, 2017, 9:37:15 AM8/9/17
to johnarvi...@gmail.com, NetBox
> File "/opt/netbox/netbox/dcim/admin.py", line 6, in <module>

This file does not exist in the current code base. Did you just copy the new code on top of the old code? The old code needs to be completely removed. The recommended practice for packaged upgrades is to switch to a new directory for each upgrade and use a symlink. For instance:

$ ls /opt
netbox -> netbox-2.1.2
netbox-2.1.1
netbox-2.1.2

Jeremy


--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to netbox-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/cf4bba94-d4f3-452f-91ed-183d469de41a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Brian Candler

unread,
Aug 10, 2017, 3:51:30 AM8/10/17
to NetBox
On Wednesday, 9 August 2017 14:37:15 UTC+1, Jeremy Stretch wrote:
This file does not exist in the current code base. Did you just copy the new code on top of the old code? The old code needs to be completely removed. The recommended practice for packaged upgrades is to switch to a new directory for each upgrade and use a symlink.

Aside: another way that works is to use a git checkout, and inside the checkout select the version you want (this gives you a "detached" working copy, not connected to any local branch)

git fetch
git tag   # to list available versions
git checkout v2.1.2
./upgrade.sh
supervisorctl restart netbox

When a new version comes out, just repeat.  The 'git checkout' will automatically remove files which were in the previous version but not in the current.

johnarvi...@gmail.com

unread,
Aug 10, 2017, 4:27:30 AM8/10/17
to NetBox
That is correct, I used an old way of upgrading netbox.
I looked at the link you refereed but something does not make sense:

# ln -sf netbox-X.Y.Z/ netbox
In my case this create a symlink in the folder netbox to the folder netbox-X.Y.Z/

# cp /opt/netbox-X.Y.Z/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py
This tried to copy a non existing file and overwrite my existing config
Same with the rest of the cp in the documentation



To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To post to this group, send email to netbox-...@googlegroups.com.

johnarvi...@gmail.com

unread,
Aug 10, 2017, 4:29:34 AM8/10/17
to NetBox
Thank you for your response, I managed to successfully upgrade with these commands. (May be because of old git commands I have ran)
cd /opt/
git fetch
git checkput v2.1.2 -f
./upgrade.sh
supervisorctl restart netbox
Reply all
Reply to author
Forward
0 new messages