openscap-daemon
openscap-daemon copied to clipboard
oscapd-cli error when attempting to display results of a notexisting task
Hi, when I accidentally tried to get results of a task that does not exist on my system (and never existed), I got a beautiful error with a lovely traceback, which can be seen below.
However as a user I would expect some ugly error message instead, eg. "Task number 8 does not exist".
[root@localhost ~]# oscapd-cli result 8 1 > results.xml
Traceback (most recent call last):
File "/usr/bin/oscapd-cli", line 821, in <module>
main()
File "/usr/bin/oscapd-cli", line 813, in main
cli_result(dbus_iface, args)
File "/usr/bin/oscapd-cli", line 433, in cli_result
arf = dbus_iface.GetARFOfTaskResult(args.task_id, args.result_id)
File "/usr/lib64/python3.5/site-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib64/python3.5/site-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.KeyError: Traceback (most recent call last):
File "/usr/lib64/python3.5/site-packages/dbus/service.py", line 707, in _message_cb
retval = candidate_method(self, *args, **keywords)
File "/usr/lib/python3.5/site-packages/openscap_daemon/dbus_daemon.py", line 341, in GetARFOfTaskResult
return self.system.get_xml_of_task_result(task_id, result_id)
File "/usr/lib/python3.5/site-packages/openscap_daemon/system.py", line 607, in get_xml_of_task_result
task = self.tasks[task_id]
KeyError: dbus.Int64(8)
I am using openscap-daemon-0.1.6-1.fc25.noarch on Fedora 25 Server alpha.
I wanted to fix this but it would be a large change, would need refactoring of most methods in the system.System class. Let's postpone this.