netbox-proxbox icon indicating copy to clipboard operation
netbox-proxbox copied to clipboard

Running into Error when starting the Proxmox Full Update

Open PhilFalc0ne opened this issue 2 years ago • 8 comments

I run a fresh Netbox Installation and added the Plugin according to the Documentation (used the git repository). When running the "Proxmox Full Update", I get the error message:

<class 'AttributeError'>

object has no attribute "slug"

Python version: 3.10.4 NetBox version: 3.2.4

I also tested to run the plugin in development mode to check if there are any differences, but I've got the same error page shown. My setup looks like this:

Promox Version 7.2.3 netbox-proxbox version 0.0.5-beta1 (github) Netbox version 3.2.4

Do you have any hint for me, what was going wrong?

PhilFalc0ne avatar Jun 05 '22 16:06 PhilFalc0ne

Same issue I'm having currently, investigating...

jine avatar Jun 08 '22 14:06 jine

same issue here has someone a workaround?

eliassteiner avatar Jun 22 '22 07:06 eliassteiner

same problem

ghost avatar Jul 22 '22 10:07 ghost

same problem, does anyone have a solution?

sugoy-desu avatar Aug 03 '22 02:08 sugoy-desu

Yup, also same problem here.

JouanDeag avatar Aug 04 '22 20:08 JouanDeag

Same problem here : object has no attribute "slug"

PVE 7.2-7 Python version: 3.9.7 NetBox version: 3.2.6 netbox-proxbox version 0.0.5-beta1

Kris33 avatar Aug 07 '22 09:08 Kris33

would be nice to update the ReadMe of the project to warn people that it is currently not functioning. Would've saved me some hours today at least :)

vfosterm avatar Sep 18 '22 14:09 vfosterm

I'm new to netbox too and have been struggling with the same issues. Add my hours to @vfosterm's hours

beerygaz avatar Sep 26 '22 14:09 beerygaz

Can anyone provide a full traceback?

Chankster avatar Jan 23 '23 21:01 Chankster

If you tell me how to do it, I'll gladly provide it.

Kris33 avatar Jan 23 '23 21:01 Kris33

It depends on your install. Check your netbox service logs, check your system syslog, if using docker containers check the container log, enable debug and capture.

Chankster avatar Jan 23 '23 21:01 Chankster

Classic full install Netbox 3.4.3 on almalinux 8 + Netbox proxbox plugin from git. no docker.

Here is the Traceback:

Traceback (most recent call last):
  File "/opt/netbox/venv/lib64/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/netbox/venv/lib64/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox/venv/lib64/python3.9/site-packages/django/views/generic/base.py", line 103, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox/venv/lib64/python3.9/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/venv/lib64/python3.9/site-packages/django/views/generic/base.py", line 142, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/views.py", line 46, in get
    update_all_result = proxbox_api.update.all(remove_unused = True)
  File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/proxbox_api/update.py", line 406, in all
    cluster = create.virtualization.cluster()
  File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/proxbox_api/create/virtualization.py", line 68, in cluster
    type = cluster_type().slug
  File "/opt/netbox/venv/lib64/python3.9/site-packages/pynetbox/core/response.py", line 298, in __getattr__
    raise AttributeError('object has no attribute "{}"'.format(k))
AttributeError: object has no attribute "slug"
2023-01-23 17:43:58,979 django.request WARNING: Not Found: /favicon.ico

Kris33 avatar Jan 23 '23 21:01 Kris33

It looks like this occurs whenever the netbox configuration within the netbox_proxbox section of PLUGINS_CONFIG is incorrect. The default has port 80 specified which is most likely getting redirected to 443 by nginx/apache.

In the PLUGINS_CONFIG try setting the netbox port to 8001 (the gunicorn default). Then ensure that whatever domain specified is added to ALLOWED_HOSTS

Chankster avatar Jan 26 '23 20:01 Chankster

Nope.

It generates a connection refused error:

<class 'requests.exceptions.ConnectionError'>

HTTPConnectionPool(host='netbox.irisit.local', port=8001): Max retries exceeded with url: /api/virtualization/cluster-types/?name=Proxmox&slug=proxmox&limit=0 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f22d19cc490>: Failed to establish a new connection: [Errno 111] Connection refused'))

Python version: 3.9.13 NetBox version: 3.4.3

Traceback (most recent call last): File "/opt/netbox/venv/lib64/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/netbox/venv/lib64/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/django/views/generic/base.py", line 103, in view return self.dispatch(request, *args, **kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/django/views/generic/base.py", line 142, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/views.py", line 46, in get update_all_result = proxbox_api.update.all(remove_unused = True) File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/proxbox_api/update.py", line 406, in all cluster = create.virtualization.cluster() File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/proxbox_api/create/virtualization.py", line 67, in cluster type = cluster_type().slug File "/opt/netbox/venv/lib64/python3.9/site-packages/netbox_proxbox/proxbox_api/create/virtualization.py", line 24, in cluster_type cluster_type_proxbox = nb.virtualization.cluster_types.get( File "/opt/netbox/venv/lib64/python3.9/site-packages/pynetbox/core/endpoint.py", line 148, in get ret = next(resp, None) File "/opt/netbox/venv/lib64/python3.9/site-packages/pynetbox/core/response.py", line 117, in next next(self.response), self.endpoint.api, self.endpoint File "/opt/netbox/venv/lib64/python3.9/site-packages/pynetbox/core/query.py", line 317, in get req = self._make_call(add_params=add_params) File "/opt/netbox/venv/lib64/python3.9/site-packages/pynetbox/core/query.py", line 267, in _make_call req = getattr(self.http_session, verb)( File "/opt/netbox/venv/lib64/python3.9/site-packages/requests/sessions.py", line 600, in get return self.request("GET", url, **kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/requests/adapters.py", line 565, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='netbox.irisit.local', port=8001): Max retries exceeded with url: /api/virtualization/cluster-types/?name=Proxmox&slug=proxmox&limit=0 (Caused by NewConnectionErr('<urllib3.connection.HTTPConnection object at 0x7f22d19cc490>: Failed to establish a new connection: [Errno 111] Connection refused'))

Kris33 avatar Jan 26 '23 21:01 Kris33

Likely you have your gunicorn.py bound to localhost instead of netbox.irisit.local

Chankster avatar Jan 26 '23 21:01 Chankster

True. I followed the official guide to set it up.

So for those who would be looking for the answers to this problem: in /opt/netbox/netbox/netbox/configuration.py

I had to modify PLUGINS_CONFIG from the netbox section:

'http_port': 80, to 'http_port': 8001,

in /opt/netbox/gunicorn.py bind = '127.0.0.1:8001' to bind = 'your.beautiful.fqdn:8001'

in from /etc/nginx/nginx.conf proxy_pass http://127.0.0.1:8001; to proxy_pass http://your/beautiful.fqdn:8001;

then restart netbox, netbox-rq and nginx.

Thanks a lot to Chankster for debugging that.

Kris33 avatar Jan 26 '23 21:01 Kris33

If you change the bind from localhost just be sure you have the appropriate firewall rules or network access restrictions in place as you're exposing gunicorn beyond the local system.

I would recommend changing the netbox host in PLUGINS_CONFIG to localhost and ensuring localhost is in ALLOWED_HOSTS.

Chankster avatar Jan 26 '23 21:01 Chankster

OK Thanks.

Kris33 avatar Jan 26 '23 21:01 Kris33