Skip to content

Server without name in "servers" collection in the DB breaks the global Pause Alerts page #32

@eliezerlp

Description

@eliezerlp

Somehow ended up with this in the DB:
{
"_id": ObjectID("5817b16cc7827b0016135100"),
"ip_address": "10.9.xx.xx",
"distro": {
"version": "27",
"name": "fedora"
}
}
...instead of the usual:
{
"_id": ObjectID("58255cb39050f80016a82e62"),
"check_every": 60,
"name": "servername",
"tags": [],
"keep_data": 30,
"key": "3d1adf6fbedb0ef0adxxxxxxxxxxxx",
"date_created": 1478843571,
"uptime": "211 days 7 hours 23 minutes",
"last_check": 1531851870,
"ip_address": "10.xx.xx.xx",
"distro": {
"version": "7.5.1804",
"name": "centos"
}
}

This resulted in the following error when trying to access the global Pause Alerts page.
amon_1 | ERROR Internal Server Error: /alerts/pause/global/
amon_1 | Traceback (most recent call last):
amon_1 | File "/root/.pex/install/Django-1.7.11-py2.py3-none-any.whl.dc8612fe3bbe13c40d7a66002a1a4af1693a40e7/Django-1.7.11-py2.py3-none-any.whl/django/core/handlers/base.py", line 111, in get_response
amon_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
amon_1 | File "/root/.pex/install/Django-1.7.11-py2.py3-none-any.whl.dc8612fe3bbe13c40d7a66002a1a4af1693a40e7/Django-1.7.11-py2.py3-none-any.whl/django/contrib/auth/decorators.py", line 21, in _wrapped_view
amon_1 | return view_func(request, *args, **kwargs)
amon_1 | File "/opt/amon/amon/apps/alerts/views/pause.py", line 33, in mute_servers
amon_1 | form = MuteForm()
amon_1 | File "/opt/amon/amon/apps/alerts/forms.py", line 104, in init
amon_1 | server_fields = [('all','All'),]+[(v['_id'],v['name']) for v in all_servers]
amon_1 | KeyError: 'name'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions