MAAS Version 1.9.4+bzr4592-0ubuntu1 (trusty1)
Attempting to delete a user and get an ugly 500 Internal server error page after confirming.
Snippet from regiond.log ( https://pastebin.canonical.com/171089/ for formatting )
2016-11-18 10:15:38 [HTTPChannel,10748,127.0.0.1] 500 Error - /MAAS/accounts/tribaal/del/
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 206, in __call__
response = self.get_response(request)
File "/usr/lib/python2.7/dist-packages/maasserver/utils/views.py", line 236, in get_response
response = get_response(request)
File "/usr/lib/python2.7/dist-packages/maasserver/utils/views.py", line 210, in get_response
return django_get_response(request)
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 194, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/dist-packages/maasserver/utils/views.py", line 189, in view_atomic_with_post_commit_savepoint
return view_atomic(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 339, in inner
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", line 87, in dispatch
return handler(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/edit.py", line 257, in post
return self.delete(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/maasserver/views/settings.py", line 116, in delete
profile.delete()
File "/usr/lib/python2.7/dist-packages/maasserver/models/userprofile.py", line 82, in delete
self.user.delete()
File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 694, in delete
collector.collect([self])
File "/usr/lib/python2.7/dist-packages/django/db/models/deletion.py", line 197, in collect
field.rel.on_delete(self, field, sub_objs, self.using)
File "/usr/lib/python2.7/dist-packages/django/db/models/deletion.py", line 27, in PROTECT
sub_objs
django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'User' because they are referenced through a protected foreign key: 'StaticIPAddress.user'", [<StaticIPAddress: 10.1.100.1:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.9:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.13:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.14:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.15:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.16:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.17:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.18:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.19:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.20:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.3:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.10:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.4:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.11:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.5:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.6:type=USER_RESERVED>, <StaticIPAddress: 10.1.100.7:type=USER_RESERVED>])
I seem to have the same problem, I had to delete the Reserved IP ranges from the zone before I could delete the user. here is the error:
2017-01-05 15:28:52 maasserver. utils.views: [error] 500 Internal Server Error @ /MAAS/accounts/ admin2/ del/ python3/ dist-packages/ django/ core/handlers/ base.py" , line 132, in get_response callback( request, *callback_args, **callback_kwargs) python3/ dist-packages/ maasserver/ utils/views. py", line 177, in view_atomic_ with_post_ commit_ savepoint python3. 5/contextlib. py", line 30, in inner python3/ dist-packages/ django/ contrib/ auth/decorators .py", line 22, in _wrapped_view python3/ dist-packages/ django/ views/generic/ base.py" , line 71, in view request, *args, **kwargs) python3/ dist-packages/ django/ views/generic/ base.py" , line 89, in dispatch python3/ dist-packages/ django/ views/generic/ edit.py" , line 301, in post request, *args, **kwargs) python3/ dist-packages/ maasserver/ views/settings. py", line 107, in delete delete( ) python3/ dist-packages/ maasserver/ models/ userprofile. py", line 77, in delete user.delete( ) python3/ dist-packages/ django/ db/models/ base.py" , line 895, in delete collect( [self]) python3/ dist-packages/ django/ db/models/ deletion. py", line 229, in collect rel.on_ delete( self, field, sub_objs, self.using) python3/ dist-packages/ django/ db/models/ deletion. py", line 28, in PROTECT db.models. deletion. ProtectedError: ("Cannot delete some instances of model 'User' because they are referenced through a protected foreign key: 'IPRange.user'", [IPRange( subnet_ id=2, start_ip= '172.0. 0.10', end_ip= '172.0. 0.99', type='dynamic', user_id=3, comment="Added via 'Provide DHCP...' in Web UI.")])
Traceback (most recent call last):
File "/usr/lib/
response = wrapped_
File "/usr/lib/
return view_atomic(*args, **kwargs)
File "/usr/lib/
return func(*args, **kwds)
File "/usr/lib/
return view_func(request, *args, **kwargs)
File "/usr/lib/
return self.dispatch(
File "/usr/lib/
return handler(request, *args, **kwargs)
File "/usr/lib/
return self.delete(
File "/usr/lib/
profile.
File "/usr/lib/
self.
File "/usr/lib/
collector.
File "/usr/lib/
field.
File "/usr/lib/
sub_objs
django.