I'm in version 4.8.1
So the patch is working with your command.
$ patch -p2 -d /usr/share/pyshared < 1625.diff
- patching file nav/portadmin/snmputils.py
- patching file nav/smidumps/dnos_switching_mib.py
- patching file nav/web/portadmin/views.py
But when I restart apache here's the error in the log

[Fri Dec 01 10:44:51.120158 2017] [wsgi:error] mod_wsgi (pid=25398): Exception occurred processing WSGI script '/usr/share/pyshared/nav/wsgi.py'.
[Fri Dec 01 10:44:51.120220 2017] [wsgi:error]  Traceback (most recent call last):
[Fri Dec 01 10:44:51.120244 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Fri Dec 01 10:44:51.129077 2017] [wsgi:error]     response = self.get_response(request)
[Fri Dec 01 10:44:51.129101 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 199, in get_response
[Fri Dec 01 10:44:51.129131 2017] [wsgi:error]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Fri Dec 01 10:44:51.129146 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 239, in handle_uncaught_exception
[Fri Dec 01 10:44:51.129168 2017] [wsgi:error]     if resolver.urlconf_module is None:
[Fri Dec 01 10:44:51.129181 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 366, in urlconf_module
[Fri Dec 01 10:44:51.129202 2017] [wsgi:error]     self._urlconf_module = import_module(self.urlconf_name)
[Fri Dec 01 10:44:51.129215 2017] [wsgi:error]   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Dec 01 10:44:51.129235 2017] [wsgi:error]     __import__(name)
[Fri Dec 01 10:44:51.129247 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/django/urls.py", line 33, in <module>
[Fri Dec 01 10:44:51.129271 2017] [wsgi:error]     (r'^arnold/', include('nav.web.arnold.urls')),
[Fri Dec 01 10:44:51.129293 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 28, in include
[Fri Dec 01 10:44:51.129315 2017] [wsgi:error]     urlconf_module = import_module(urlconf_module)
[Fri Dec 01 10:44:51.129328 2017] [wsgi:error]   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Dec 01 10:44:51.129347 2017] [wsgi:error]     __import__(name)
[Fri Dec 01 10:44:51.129359 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/web/arnold/urls.py", line 19, in <module>
[Fri Dec 01 10:44:51.129381 2017] [wsgi:error]     from nav.web.arnold.views import (render_history, render_detained_ports,
[Fri Dec 01 10:44:51.129394 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/web/arnold/views.py", line 27, in <module>
[Fri Dec 01 10:44:51.129415 2017] [wsgi:error]     from nav.arnold import (open_port, disable, quarantine, GeneralException,
[Fri Dec 01 10:44:51.129428 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/arnold.py", line 43, in <module>
[Fri Dec 01 10:44:51.129449 2017] [wsgi:error]     from nav.portadmin.snmputils import SNMPFactory
[Fri Dec 01 10:44:51.129461 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/portadmin/snmputils.py", line 817, in <module>
[Fri Dec 01 10:44:51.129482 2017] [wsgi:error]     class Dell(SNMPHandler):
[Fri Dec 01 10:44:51.129494 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/portadmin/snmputils.py", line 823, in Dell
[Fri Dec 01 10:44:51.129515 2017] [wsgi:error]     from nav.smidumps.dnos_switching_mib import MIB as mib
[Fri Dec 01 10:44:51.129536 2017] [wsgi:error] ImportError: No module named dnos_switching_mib
[Fri Dec 01 10:45:22.516966 2017] [wsgi:error] mod_wsgi (pid=25397): Exception occurred processing WSGI script '/usr/share/pyshared/nav/wsgi.py'.
[Fri Dec 01 10:45:22.517020 2017] [wsgi:error] Traceback (most recent call last):
[Fri Dec 01 10:45:22.517042 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Fri Dec 01 10:45:22.517154 2017] [wsgi:error]     response = self.get_response(request)
[Fri Dec 01 10:45:22.517172 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 199, in get_response
[Fri Dec 01 10:45:22.517198 2017] [wsgi:error]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Fri Dec 01 10:45:22.517211 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 239, in handle_uncaught_exception
[Fri Dec 01 10:45:22.517231 2017] [wsgi:error]     if resolver.urlconf_module is None:
[Fri Dec 01 10:45:22.517243 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 366, in urlconf_module
[Fri Dec 01 10:45:22.517274 2017] [wsgi:error]     self._urlconf_module = import_module(self.urlconf_name)
[Fri Dec 01 10:45:22.517288 2017] [wsgi:error]   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Dec 01 10:45:22.517307 2017] [wsgi:error]     __import__(name)
[Fri Dec 01 10:45:22.517320 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/django/urls.py", line 33, in <module>
[Fri Dec 01 10:45:22.517341 2017] [wsgi:error]     (r'^arnold/', include('nav.web.arnold.urls')),
[Fri Dec 01 10:45:22.517354 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 28, in include
[Fri Dec 01 10:45:22.517373 2017] [wsgi:error]     urlconf_module = import_module(urlconf_module)
[Fri Dec 01 10:45:22.517385 2017] [wsgi:error]   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Dec 01 10:45:22.517403 2017] [wsgi:error]     __import__(name)
[Fri Dec 01 10:45:22.517415 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/web/arnold/urls.py", line 19, in <module>
[Fri Dec 01 10:45:22.517436 2017] [wsgi:error]     from nav.web.arnold.views import (render_history, render_detained_ports,
[Fri Dec 01 10:45:22.517448 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/web/arnold/views.py", line 27, in <module>
[Fri Dec 01 10:45:22.517470 2017] [wsgi:error]     from nav.arnold import (open_port, disable, quarantine, GeneralException,
[Fri Dec 01 10:45:22.517482 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/arnold.py", line 43, in <module>
[Fri Dec 01 10:45:22.517502 2017] [wsgi:error]     from nav.portadmin.snmputils import SNMPFactory
[Fri Dec 01 10:45:22.517515 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/portadmin/snmputils.py", line 817, in <module>
[Fri Dec 01 10:45:22.517535 2017] [wsgi:error]     class Dell(SNMPHandler):
[Fri Dec 01 10:45:22.517548 2017] [wsgi:error]   File "/usr/lib/python2.7/dist-packages/nav/portadmin/snmputils.py", line 823, in Dell
[Fri Dec 01 10:45:22.517567 2017] [wsgi:error]     from nav.smidumps.dnos_switching_mib import MIB as mib
[Fri Dec 01 10:45:22.517586 2017] [wsgi:error] ImportError: No module named dnos_switching_mib

Cordialement,
IOGS Logo
Ludovic Vinsonnaud - Ingénieur Réseau
basé à Bordeaux, bureau F108 (IOA, Rue François Mitterrand, 33400 Talence)

Institut Optique Graduate School
2 Avenue Augustin Fresnel - 91127 PALAISEAU Cedex
Tel. +33 5 57 01 71 52 - Mob. +33 6 08 08 41 05
Le 01/12/2017 à 12:54, Morten Brekkevold a écrit :
On Fri, 1 Dec 2017 12:31:18 +0100 Vinsonnaud Ludovic <ludovic.vinsonnaud@institutoptique.fr> wrote:

I'm trying to apply the patch following the instructions but I have some
problems.
The instructions talk about only 1 file and the patch 1625.diff concern 3
files (snmputils.py, dnos_switching_mib.py and portadmin/views.py).
Is there a way to apply to all files directly ?

As I see in 1625.diff, the first file concerned is snmputils.py so I tried
with this file
Hi there,

all the files are in the Python libraries of NAV, so they should all be
patchable using this command (optional --dry-run first, of course):

  patch -p2 -d /usr/share/pyshared < 1625.diff

BUT, I think one crucial bit of information that was missing from the
instructions: The patch is based on NAV 4.8. If you are are still on
4.7, there may be differences that cause the patch to fail.