Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete machines from unreachable networks #247

Open
SchoolGuy opened this issue Mar 26, 2024 · 1 comment
Open

Cannot delete machines from unreachable networks #247

SchoolGuy opened this issue Mar 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SchoolGuy
Copy link
Collaborator

Reproducer

  1. Delete a machine in the Admin UI when it is not reachable
  2. Press "Delete"
  3. See error

Log

Mär 26 11:52:26 orthos2 uwsgi[8444]: Internal Server Error: /admin/data/machine/
Mär 26 11:52:26 orthos2 uwsgi[8444]: Traceback (most recent call last):
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/ssh.py", line 108, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     self._client.connect(**configuration)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/paramiko/client.py", line 343, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     retry_on_signal(lambda: sock.connect(addr))
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/paramiko/util.py", line 280, in retry_on_signal
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return function()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/paramiko/client.py", line 343, in <lambda>
Mär 26 11:52:26 orthos2 uwsgi[8444]:     retry_on_signal(lambda: sock.connect(addr))
Mär 26 11:52:26 orthos2 uwsgi[8444]: OSError: [Errno 101] Network is unreachable
Mär 26 11:52:26 orthos2 uwsgi[8444]: During handling of the above exception, another exception occurred:
Mär 26 11:52:26 orthos2 uwsgi[8444]: Traceback (most recent call last):
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = get_response(request)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 616, in wrapper
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return self.admin_site.admin_view(view)(*args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = view_func(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = view_func(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 232, in inner
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return view(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/utils/decorators.py", line 43, in _wrapper
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return bound_method(*args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = view_func(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1739, in changelist_view
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = self.response_action(request, queryset=cl.get_queryset(request))
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1408, in response_action
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = func(self, request, queryset)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/actions.py", line 45, in delete_selected
Mär 26 11:52:26 orthos2 uwsgi[8444]:     modeladmin.delete_queryset(request, queryset)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1109, in delete_queryset
Mär 26 11:52:26 orthos2 uwsgi[8444]:     queryset.delete()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 746, in delete
Mär 26 11:52:26 orthos2 uwsgi[8444]:     deleted, _rows_count = collector.delete()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/db/models/deletion.py", line 405, in delete
Mär 26 11:52:26 orthos2 uwsgi[8444]:     sender=model, instance=obj, using=self.using
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 182, in send
Mär 26 11:52:26 orthos2 uwsgi[8444]:     for receiver in self._live_receivers(sender)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 182, in <listcomp>
Mär 26 11:52:26 orthos2 uwsgi[8444]:     for receiver in self._live_receivers(sender)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/data/signals.py", line 105, in machine_pre_delete
Mär 26 11:52:26 orthos2 uwsgi[8444]:     server.remove(instance)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/cobbler.py", line 248, in remove
Mär 26 11:52:26 orthos2 uwsgi[8444]:     self.connect()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/cobbler.py", line 184, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     self._conn.connect()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/ssh.py", line 112, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     raise SSH.Exception("Socket error: {}".format(e))
Mär 26 11:52:26 orthos2 uwsgi[8444]: orthos2.utils.ssh.SSH.Exception: Socket error: [Errno 101] Network is unreachable
Mär 26 11:52:26 orthos2 uwsgi[8444]: EE:django.request:Internal Server Error: /admin/data/machine/
Mär 26 11:52:26 orthos2 uwsgi[8444]: Traceback (most recent call last):
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/ssh.py", line 108, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     self._client.connect(**configuration)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/paramiko/client.py", line 343, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     retry_on_signal(lambda: sock.connect(addr))
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/paramiko/util.py", line 280, in retry_on_signal
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return function()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/paramiko/client.py", line 343, in <lambda>
Mär 26 11:52:26 orthos2 uwsgi[8444]:     retry_on_signal(lambda: sock.connect(addr))
Mär 26 11:52:26 orthos2 uwsgi[8444]: OSError: [Errno 101] Network is unreachable
Mär 26 11:52:26 orthos2 uwsgi[8444]: During handling of the above exception, another exception occurred:
Mär 26 11:52:26 orthos2 uwsgi[8444]: Traceback (most recent call last):
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = get_response(request)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 616, in wrapper
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return self.admin_site.admin_view(view)(*args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = view_func(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = view_func(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 232, in inner
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return view(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/utils/decorators.py", line 43, in _wrapper
Mär 26 11:52:26 orthos2 uwsgi[8444]:     return bound_method(*args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = view_func(request, *args, **kwargs)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1739, in changelist_view
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = self.response_action(request, queryset=cl.get_queryset(request))
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1408, in response_action
Mär 26 11:52:26 orthos2 uwsgi[8444]:     response = func(self, request, queryset)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/actions.py", line 45, in delete_selected
Mär 26 11:52:26 orthos2 uwsgi[8444]:     modeladmin.delete_queryset(request, queryset)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1109, in delete_queryset
Mär 26 11:52:26 orthos2 uwsgi[8444]:     queryset.delete()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 746, in delete
Mär 26 11:52:26 orthos2 uwsgi[8444]:     deleted, _rows_count = collector.delete()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/db/models/deletion.py", line 405, in delete
Mär 26 11:52:26 orthos2 uwsgi[8444]:     sender=model, instance=obj, using=self.using
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 182, in send
Mär 26 11:52:26 orthos2 uwsgi[8444]:     for receiver in self._live_receivers(sender)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "/usr/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 182, in <listcomp>
Mär 26 11:52:26 orthos2 uwsgi[8444]:     for receiver in self._live_receivers(sender)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/data/signals.py", line 105, in machine_pre_delete
Mär 26 11:52:26 orthos2 uwsgi[8444]:     server.remove(instance)
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/cobbler.py", line 248, in remove
Mär 26 11:52:26 orthos2 uwsgi[8444]:     self.connect()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/cobbler.py", line 184, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     self._conn.connect()
Mär 26 11:52:26 orthos2 uwsgi[8444]:   File "./orthos2/utils/ssh.py", line 112, in connect
Mär 26 11:52:26 orthos2 uwsgi[8444]:     raise SSH.Exception("Socket error: {}".format(e))
Mär 26 11:52:26 orthos2 uwsgi[8444]: orthos2.utils.ssh.SSH.Exception: Socket error: [Errno 101] Network is unreachable
@SchoolGuy SchoolGuy added the bug Something isn't working label Mar 26, 2024
@SchoolGuy
Copy link
Collaborator Author

It appears that the issue here is that it tries to reach Cobbler and fails to do so. I think we need to introduce a flag that allows for force deletion without connection to Cobbler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant